Search in sources :

Example 1 with ExecType

use of liquibase.changelog.ChangeSet.ExecType 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 {
    ChangeSet.RunStatus runStatus = this.database.getRunStatus(changeSet);
    log.debug("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 : MigrationFailedException(liquibase.exception.MigrationFailedException) 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