Quellcode durchsuchen

always disable migration when creating database for the first time

tags/2.0.1
Jonathan Cobb vor 4 Jahren
Ursprung
Commit
443e62eee7
1 geänderte Dateien mit 4 neuen und 3 gelöschten Zeilen
  1. +4
    -3
      wizard-server/src/main/java/org/cobbzilla/wizard/server/listener/SystemInitializerListener.java

+ 4
- 3
wizard-server/src/main/java/org/cobbzilla/wizard/server/listener/SystemInitializerListener.java Datei anzeigen

@@ -66,8 +66,9 @@ public class SystemInitializerListener extends RestServerLifecycleListenerBase {
if (checkTable) {
ok = checkTable(config);
if (!ok) {
// create the schema when the test table does not exist
// create the schema when the test table does not exist. Disable migration
config.getDatabase().getHibernate().setHbm2ddlAuto("create");
config.getDatabase().setMigrationEnabled(false);
}
} else {
config.execSql("select 1");
@@ -124,7 +125,7 @@ public class SystemInitializerListener extends RestServerLifecycleListenerBase {
try {
return runTableCheck(config, tableName);
} catch (Exception e) {
log.warn("table '"+tableName+"' not found, will create schema: " + shortError(e));
log.warn("table '"+tableName+"' not found, will create schema (disabling migration): " + shortError(e));
config.getDatabase().getHibernate().setHbm2ddlAuto("create");
config.getDatabase().setMigrationEnabled(false);
}
@@ -145,7 +146,7 @@ public class SystemInitializerListener extends RestServerLifecycleListenerBase {
try {
runTableCheck(config, tableName);
} catch (Exception e) {
die(PREFIX + "table '"+tableName+"' not found: " + shortError(e));
die(PREFIX + "runTableCheck failed for table '"+tableName+"': " + shortError(e));
}
}
if (isCheckRedis()) {


Laden…
Abbrechen
Speichern