use of liquibase.statement.core.CreateDatabaseChangeLogTableStatement in project keycloak by keycloak.
the class LiquibaseJpaUpdaterProvider method outputChangeLogTableCreationScript.
private void outputChangeLogTableCreationScript(Liquibase liquibase, final Writer exportWriter) throws DatabaseException {
Database database = liquibase.getDatabase();
ExecutorService executorService = Scope.getCurrentScope().getSingleton(ExecutorService.class);
Executor oldTemplate = executorService.getExecutor(LiquibaseConstants.JDBC_EXECUTOR, database);
LoggingExecutor loggingExecutor = new LoggingExecutor(oldTemplate, exportWriter, database);
executorService.setExecutor(LiquibaseConstants.JDBC_EXECUTOR, database, loggingExecutor);
loggingExecutor.comment("*********************************************************************");
loggingExecutor.comment("* Keycloak database creation script - apply this script to empty DB *");
loggingExecutor.comment("*********************************************************************" + StreamUtil.getLineSeparator());
loggingExecutor.execute(new CreateDatabaseChangeLogTableStatement());
// DatabaseChangeLogLockTable is created before this code is executed and recreated if it does not exist automatically
// in org.keycloak.connections.jpa.updater.liquibase.lock.CustomLockService.init() called indirectly from
// KeycloakApplication constructor (search for waitForLock() call). Hence it is not included in the creation script.
loggingExecutor.comment("*********************************************************************" + StreamUtil.getLineSeparator());
executorService.setExecutor(LiquibaseConstants.JDBC_EXECUTOR, database, oldTemplate);
}
use of liquibase.statement.core.CreateDatabaseChangeLogTableStatement in project liquibase by liquibase.
the class OfflineChangeLogHistoryService method init.
@Override
public void init() throws DatabaseException {
if (!changeLogFile.exists()) {
changeLogFile.getParentFile().mkdirs();
try {
changeLogFile.createNewFile();
writeHeader(changeLogFile);
if (isExecuteDdlAgainstDatabase()) {
Scope.getCurrentScope().getSingleton(ExecutorService.class).getExecutor("jdbc", getDatabase()).execute(new CreateDatabaseChangeLogTableStatement());
}
} catch (Exception e) {
throw new UnexpectedLiquibaseException(e);
}
}
}
use of liquibase.statement.core.CreateDatabaseChangeLogTableStatement in project keycloak by keycloak.
the class QuarkusJpaUpdaterProvider method outputChangeLogTableCreationScript.
private void outputChangeLogTableCreationScript(Liquibase liquibase, final Writer exportWriter) throws DatabaseException {
Database database = liquibase.getDatabase();
ExecutorService executorService = Scope.getCurrentScope().getSingleton(ExecutorService.class);
Executor oldTemplate = executorService.getExecutor(LiquibaseConstants.JDBC_EXECUTOR, database);
LoggingExecutor loggingExecutor = new LoggingExecutor(executorService.getExecutor(LiquibaseConstants.JDBC_EXECUTOR, database), exportWriter, database);
executorService.setExecutor(LiquibaseConstants.JDBC_EXECUTOR, database, loggingExecutor);
loggingExecutor.comment("*********************************************************************");
loggingExecutor.comment("* Keycloak database creation script - apply this script to empty DB *");
loggingExecutor.comment("*********************************************************************" + StreamUtil.getLineSeparator());
loggingExecutor.execute(new CreateDatabaseChangeLogTableStatement());
// DatabaseChangeLogLockTable is created before this code is executed and recreated if it does not exist automatically
// in org.keycloak.connections.jpa.updater.liquibase.lock.CustomLockService.init() called indirectly from
// KeycloakApplication constructor (search for waitForLock() call). Hence it is not included in the creation script.
loggingExecutor.comment("*********************************************************************" + StreamUtil.getLineSeparator());
executorService.setExecutor(LiquibaseConstants.JDBC_EXECUTOR, database, oldTemplate);
}
Aggregations