Search in sources :

Example 1 with RunStatus

use of liquibase.changelog.ChangeSet.RunStatus in project liquibase by liquibase.

the class UpdateVisitor method visit.

@Override
public void visit(ChangeSet changeSet, DatabaseChangeLog databaseChangeLog, Database database, Set<ChangeSetFilterResult> filterResults) throws LiquibaseException {
    Executor executor = Scope.getCurrentScope().getSingleton(ExecutorService.class).getExecutor("jdbc", database);
    if (!(executor instanceof LoggingExecutor)) {
        Scope.getCurrentScope().getUI().sendMessage("Running Changeset: " + changeSet);
    }
    ChangeSet.RunStatus runStatus = this.database.getRunStatus(changeSet);
    Scope.getCurrentScope().getLog(getClass()).fine("Running Changeset: " + changeSet);
    fireWillRun(changeSet, databaseChangeLog, database, runStatus);
    ExecType execType = null;
    ObjectQuotingStrategy previousStr = this.database.getObjectQuotingStrategy();
    try {
        execType = changeSet.execute(databaseChangeLog, execListener, this.database);
    } catch (MigrationFailedException e) {
        fireRunFailed(changeSet, databaseChangeLog, database, e);
        throw e;
    }
    if (!runStatus.equals(ChangeSet.RunStatus.NOT_RAN)) {
        execType = ChangeSet.ExecType.RERAN;
    }
    fireRan(changeSet, databaseChangeLog, database, execType);
    // reset object quoting strategy after running changeset
    this.database.setObjectQuotingStrategy(previousStr);
    this.database.markChangeSetExecStatus(changeSet, execType);
    this.database.commit();
}
Also used : LoggingExecutor(liquibase.executor.LoggingExecutor) Executor(liquibase.executor.Executor) MigrationFailedException(liquibase.exception.MigrationFailedException) LoggingExecutor(liquibase.executor.LoggingExecutor) ExecutorService(liquibase.executor.ExecutorService) RunStatus(liquibase.changelog.ChangeSet.RunStatus) ExecType(liquibase.changelog.ChangeSet.ExecType) ChangeSet(liquibase.changelog.ChangeSet) ObjectQuotingStrategy(liquibase.database.ObjectQuotingStrategy)

Aggregations

ChangeSet (liquibase.changelog.ChangeSet)1 ExecType (liquibase.changelog.ChangeSet.ExecType)1 RunStatus (liquibase.changelog.ChangeSet.RunStatus)1 ObjectQuotingStrategy (liquibase.database.ObjectQuotingStrategy)1 MigrationFailedException (liquibase.exception.MigrationFailedException)1 Executor (liquibase.executor.Executor)1 ExecutorService (liquibase.executor.ExecutorService)1 LoggingExecutor (liquibase.executor.LoggingExecutor)1