Skip to content

Commit

Permalink
Merge pull request #2222 from msimko81/master
Browse files Browse the repository at this point in the history
Add offline mode support for rollbackSQL <tag>
  • Loading branch information
nvoxland committed Feb 14, 2022
2 parents 9333465 + 76cf69a commit 7403ec2
Showing 1 changed file with 11 additions and 1 deletion.
Expand Up @@ -3,7 +3,9 @@
import liquibase.ContextExpression;
import liquibase.Labels;
import liquibase.Scope;
import liquibase.change.Change;
import liquibase.change.CheckSum;
import liquibase.change.core.TagDatabaseChange;
import liquibase.changelog.ChangeSet.ExecType;
import liquibase.GlobalConfiguration;
import liquibase.database.Database;
Expand Down Expand Up @@ -244,6 +246,14 @@ protected void appendChangeSet(ChangeSet changeSet, ChangeSet.ExecType execType)
csvWriter.writeNext(line);
}

String tag = "";
for (Change change : changeSet.getChanges()) {
if (change instanceof TagDatabaseChange) {
TagDatabaseChange tagChange = (TagDatabaseChange) change;
tag = tagChange.getTag();
}
}

String[] newLine = new String[Columns.values().length];
newLine[Columns.ID.ordinal()] = changeSet.getId();
newLine[Columns.AUTHOR.ordinal()] = changeSet.getAuthor();
Expand All @@ -254,7 +264,7 @@ protected void appendChangeSet(ChangeSet changeSet, ChangeSet.ExecType execType)
newLine[Columns.MD5SUM.ordinal()] = changeSet.generateCheckSum().toString();
newLine[Columns.DESCRIPTION.ordinal()] = changeSet.getDescription();
newLine[Columns.COMMENTS.ordinal()] = changeSet.getComments();
newLine[Columns.TAG.ordinal()] = "";
newLine[Columns.TAG.ordinal()] = tag;
newLine[Columns.LIQUIBASE.ordinal()] = LiquibaseUtil.getBuildVersion();

newLine[Columns.CONTEXTS.ordinal()] = (changeSet.getContexts() == null) ? null : changeSet.getContexts().toString();
Expand Down

0 comments on commit 7403ec2

Please sign in to comment.