ENH: allow server startup without running ddl and thus allowing starting with the database not yet up and later lazily initializing the database and running ddl

This commit is contained in:
Jonas Pöhler committed 2021-10-22 13:59:54 +02:00
1 parent 45aa04e086
commit af0f9a4d15
7 files changed
+233 -4

No files matched your search

@@ -1717,6 +1717,12 @@ public interface Database {
*/
<T> Set<String> validateQuery(Query<T> query);
/**
* Runs the DbMigration or DDL manually. This is normally executed on startup, as long as
* serverConfig.initDatabase is set to true.
*/
void initDatabase(boolean online);
/**
* Load and lock the bean using {@code select for update}.
* <p>
@@ -300,7 +300,9 @@ public class DatabaseConfig {
*/
private ExternalTransactionManager externalTransactionManager;
private boolean skipDataSourceCheck;
private boolean skipDataSourceCheck = false;
private boolean skipInitDatabase = false;
/**
* The data source (if programmatically provided).
@@ -1635,6 +1637,14 @@ public class DatabaseConfig {
this.skipDataSourceCheck = skipDataSourceCheck;
}
public boolean skipInitDatabase() {
return skipInitDatabase;
}
public void setSkipInitDatabase(final boolean skipInitDatabase) {
this.skipInitDatabase = skipInitDatabase;
}
/**
* Return the DataSource.
*/
@@ -2710,7 +2720,6 @@ public class DatabaseConfig {
}
/**
* Load settings from application.properties, application.yaml and other sources.
* <p>
@@ -2903,6 +2912,7 @@ public class DatabaseConfig {
jsonMutationDetection = p.getEnum(MutationDetection.class, "jsonMutationDetection", jsonMutationDetection);
skipDataSourceCheck = p.getBoolean("skipDataSourceCheck", skipDataSourceCheck);
skipInitDatabase = p.getBoolean("skipInitDatabase", skipInitDatabase);
runMigration = p.getBoolean("migration.run", runMigration);
ddlGenerate = p.getBoolean("ddl.generate", ddlGenerate);
ddlRun = p.getBoolean("ddl.run", ddlRun);