Skip to content

Commit

Permalink
DAT-15857 - Fix for checksum upgrade in runWith change sets (#4874)
Browse files Browse the repository at this point in the history
DAT-15857
---------

Co-authored-by: Wesley Willard <wwillard@datical.com>
  • Loading branch information
filipelautert and wwillard7800 committed Sep 11, 2023
1 parent acfe8ed commit 727c540
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import liquibase.statement.SqlStatement;
import liquibase.statement.core.RawCompoundStatement;
import liquibase.statement.core.RawSqlStatement;
import liquibase.util.BooleanUtil;
import liquibase.util.StringUtil;

import java.io.ByteArrayInputStream;
Expand All @@ -36,6 +37,8 @@ public abstract class AbstractSQLChange extends AbstractChange implements DbmsTa

private boolean stripComments;
private boolean splitStatements;

private Boolean originalSplitStatements;
/**
*
* @deprecated To be removed when splitStatements is changed to be type Boolean
Expand All @@ -55,6 +58,10 @@ protected AbstractSQLChange() {
setSplitStatements(null);
}

public void setOriginalSplitStatements(Boolean originalSplitStatements) {
this.originalSplitStatements = originalSplitStatements;
}

public InputStream openSqlStream() throws IOException {
return null;
}
Expand Down Expand Up @@ -216,7 +223,11 @@ public CheckSum generateCheckSum() {

ChecksumVersion version = Scope.getCurrentScope().getChecksumVersion();
if (version.lowerOrEqualThan(ChecksumVersion.V8)) {
return CheckSum.compute(new NormalizingStreamV8(this.getEndDelimiter(), this.isSplitStatements(), this.isStripComments(), stream), false);
boolean isSplitStatements = this.isSplitStatements();
if (getChangeSet() != null && getChangeSet().getRunWith() != null) {
isSplitStatements = BooleanUtil.isTrue(originalSplitStatements);
}
return CheckSum.compute(new NormalizingStreamV8(this.getEndDelimiter(), isSplitStatements, this.isStripComments(), stream), false);
}
return CheckSum.compute(new AbstractSQLChange.NormalizingStream(stream), false);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import liquibase.changelog.ChangeSet
import liquibase.changelog.DatabaseChangeLog
import liquibase.database.core.MockDatabase
import liquibase.exception.UnexpectedLiquibaseException
import liquibase.integration.commandline.LiquibaseCommandLineConfiguration
import liquibase.statement.SqlStatement
import liquibase.test.JUnitResourceAccessor
import liquibase.util.StreamUtil
Expand Down

0 comments on commit 727c540

Please sign in to comment.