Search in sources :

Example 11 with LoggingExecutor

use of liquibase.executor.LoggingExecutor in project liquibase by liquibase.

the class Liquibase method update.

public void update(Contexts contexts, LabelExpression labelExpression, Writer output, boolean checkLiquibaseTables) throws LiquibaseException {
    changeLogParameters.setContexts(contexts);
    changeLogParameters.setLabels(labelExpression);
    Executor oldTemplate = ExecutorService.getInstance().getExecutor(database);
    LoggingExecutor loggingExecutor = new LoggingExecutor(ExecutorService.getInstance().getExecutor(database), output, database);
    ExecutorService.getInstance().setExecutor(database, loggingExecutor);
    outputHeader("Update Database Script");
    LockService lockService = LockServiceFactory.getInstance().getLockService(database);
    lockService.waitForLock();
    try {
        update(contexts, labelExpression, checkLiquibaseTables);
        output.flush();
    } catch (IOException e) {
        throw new LiquibaseException(e);
    }
    ExecutorService.getInstance().setExecutor(database, oldTemplate);
}
Also used : Executor(liquibase.executor.Executor) LoggingExecutor(liquibase.executor.LoggingExecutor) LockService(liquibase.lockservice.LockService) LoggingExecutor(liquibase.executor.LoggingExecutor) UnexpectedLiquibaseException(liquibase.exception.UnexpectedLiquibaseException) LiquibaseException(liquibase.exception.LiquibaseException)

Example 12 with LoggingExecutor

use of liquibase.executor.LoggingExecutor in project liquibase by liquibase.

the class Liquibase method changeLogSync.

public void changeLogSync(Contexts contexts, LabelExpression labelExpression, Writer output) throws LiquibaseException {
    changeLogParameters.setContexts(contexts);
    changeLogParameters.setLabels(labelExpression);
    LoggingExecutor outputTemplate = new LoggingExecutor(ExecutorService.getInstance().getExecutor(database), output, database);
    Executor oldTemplate = ExecutorService.getInstance().getExecutor(database);
    ExecutorService.getInstance().setExecutor(database, outputTemplate);
    outputHeader("SQL to add all changesets to database history table");
    changeLogSync(contexts, labelExpression);
    try {
        output.flush();
    } catch (IOException e) {
        throw new LiquibaseException(e);
    }
    ExecutorService.getInstance().setExecutor(database, oldTemplate);
    resetServices();
}
Also used : Executor(liquibase.executor.Executor) LoggingExecutor(liquibase.executor.LoggingExecutor) LoggingExecutor(liquibase.executor.LoggingExecutor) UnexpectedLiquibaseException(liquibase.exception.UnexpectedLiquibaseException) LiquibaseException(liquibase.exception.LiquibaseException)

Aggregations

LoggingExecutor (liquibase.executor.LoggingExecutor)12 Executor (liquibase.executor.Executor)11 UnexpectedLiquibaseException (liquibase.exception.UnexpectedLiquibaseException)10 LiquibaseException (liquibase.exception.LiquibaseException)9 LockService (liquibase.lockservice.LockService)2 File (java.io.File)1 List (java.util.List)1 Change (liquibase.change.Change)1 ChangeSet (liquibase.changelog.ChangeSet)1 Database (liquibase.database.Database)1 OfflineConnection (liquibase.database.OfflineConnection)1 HsqlDatabase (liquibase.database.core.HsqlDatabase)1 LockException (liquibase.exception.LockException)1 MigrationFailedException (liquibase.exception.MigrationFailedException)1 ParsedNodeException (liquibase.parser.core.ParsedNodeException)1 ClassLoaderResourceAccessor (liquibase.resource.ClassLoaderResourceAccessor)1 Sql (liquibase.sql.Sql)1 SqlStatement (liquibase.statement.SqlStatement)1 CommentStatement (liquibase.statement.core.CommentStatement)1 RuntimeStatement (liquibase.statement.core.RuntimeStatement)1