Compare commits

..

No commits in common. "c7eadc607dc63a29a2f279406d32c89e2bce35cb" and "da3c467569f11a21e5e209d9e7950598f9d3aa6e" have entirely different histories.

4 changed files with 28 additions and 43 deletions

View File

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>kangaroo-and-rabbit</groupId>
<artifactId>archidata</artifactId>
<version>0.23.6</version>
<version>0.23.4</version>
<properties>
<java.version>21</java.version>
<maven.compiler.version>3.1</maven.compiler.version>

View File

@ -11,7 +11,6 @@ import org.kar.archidata.dataAccess.DataFactory;
import org.kar.archidata.dataAccess.QueryOptions;
import org.kar.archidata.db.DbConfig;
import org.kar.archidata.migration.model.Migration;
import org.kar.archidata.tools.ConfigBaseVariable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -131,40 +130,35 @@ public class MigrationEngine {
}
private void createTableIfAbleOrWaitAdmin(final DbConfig configInput) throws MigrationException {
if (ConfigBaseVariable.getDBAbleToCreate()) {
final DbConfig config = configInput.clone();
config.setDbName(null);
final String dbName = configInput.getDbName();
LOGGER.info("Verify existance of '{}'", dbName);
try (final DBAccess da = DBAccess.createInterface(config)) {
boolean exist = da.isDBExist(dbName);
if (!exist) {
LOGGER.warn("DB: '{}' DOES NOT EXIST ==> create one", dbName);
// create the local DB:
da.createDB(dbName);
final DbConfig config = configInput.clone();
config.setDbName(null);
final String dbName = configInput.getDbName();
LOGGER.info("Verify existance of '{}'", dbName);
try (final DBAccess da = DBAccess.createInterface(config)) {
boolean exist = da.isDBExist(dbName);
if (!exist) {
LOGGER.warn("DB: '{}' DOES NOT EXIST ==> create one", dbName);
// create the local DB:
da.createDB(dbName);
}
exist = da.isDBExist(dbName);
while (!exist) {
LOGGER.error("DB: '{}' DOES NOT EXIST after trying to create one ", dbName);
LOGGER.error("Waiting administrator create a new one, we check after 30 seconds...");
try {
Thread.sleep(30000);
} catch (final InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
exist = da.isDBExist(dbName);
while (!exist) {
LOGGER.error("DB: '{}' DOES NOT EXIST after trying to create one ", dbName);
LOGGER.error("Waiting administrator create a new one, we check after 30 seconds...");
try {
Thread.sleep(30000);
} catch (final InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
exist = da.isDBExist(dbName);
}
} catch (final InternalServerErrorException e) {
e.printStackTrace();
throw new MigrationException("TODO ...");
} catch (final IOException e) {
e.printStackTrace();
throw new MigrationException("TODO ...");
}
} else {
final String dbName = configInput.getDbName();
LOGGER.warn("DB: '{}' is not check if it EXIST", dbName);
} catch (final InternalServerErrorException e) {
e.printStackTrace();
throw new MigrationException("TODO ...");
} catch (final IOException e) {
e.printStackTrace();
throw new MigrationException("TODO ...");
}
}

View File

@ -3,7 +3,6 @@ package org.kar.archidata.tools;
public class ConfigBaseVariable {
static public String tmpDataFolder;
static public String dataFolder;
static public String dbAbleToCreate;
static public String dbType;
static public String dbHost;
static public String dbPort;
@ -24,7 +23,6 @@ public class ConfigBaseVariable {
public static void clearAllValue() {
tmpDataFolder = System.getenv("DATA_TMP_FOLDER");
dataFolder = System.getenv("DATA_FOLDER");
dbAbleToCreate = System.getenv("DB_ABLE_TO_CREATE");
dbType = System.getenv("DB_TYPE");
dbHost = System.getenv("DB_HOST");
dbPort = System.getenv("DB_PORT");
@ -60,13 +58,6 @@ public class ConfigBaseVariable {
return dataFolder;
}
public static boolean getDBAbleToCreate() {
if (dbAbleToCreate == null) {
return true;
}
return Boolean.getBoolean(dbAbleToCreate);
}
public static String getDBType() {
if (dbType == null) {
return "mysql";

View File

@ -1 +1 @@
0.23.6
0.23.4