01: package liquibase.parser.visitor;
02:
03: import liquibase.ChangeSet;
04: import liquibase.database.Database;
05: import liquibase.exception.LiquibaseException;
06: import liquibase.log.LogFactory;
07:
08: public class RollbackVisitor implements ChangeSetVisitor {
09:
10: private Database database;
11:
12: public RollbackVisitor(Database database) {
13: this .database = database;
14: }
15:
16: public Direction getDirection() {
17: return ChangeSetVisitor.Direction.REVERSE;
18: }
19:
20: public void visit(ChangeSet changeSet) throws LiquibaseException {
21: LogFactory.getLogger().info(
22: "Rolling Back Changeset:" + changeSet);
23: changeSet.rolback(database);
24: database.removeRanStatus(changeSet);
25:
26: database.commit();
27:
28: }
29: }
|