Top Description Constructors Methods
liquibase.util

public Class ValidatingVisitorUtil

extends Object
Class Inheritance
Imports
liquibase.ChecksumVersion, .Scope, liquibase.change.AbstractSQLChange, .Change, .ChangeFactory, .DatabaseChange, liquibase.change.core.CreateIndexChange, .DropIndexChange, .SQLFileChange, liquibase.changelog.*, liquibase.database.Database, liquibase.exception.DatabaseException, .UnexpectedLiquibaseException, java.lang.reflect.InvocationTargetException, java.util.List, .Optional, java.util.stream.Collectors

Util class to offload methods that are used by liquibase.changelog.visitor.ValidatingVisitor class and may make it more complex than it should be

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static boolean
checkLiquibaseVersionIs(String version, int major, int minor)

private static boolean
checkLiquibaseVersionMinorThan(String version, int major, int minor)

private static ChangeSet
generateNewChangeSet(DatabaseChangeLog databaseChangeLog, Change originalChange, Change newChange, ChangeSet changeSet)

public static boolean
isChecksumIssue(ChangeSet changeSet, RanChangeSet ranChangeSet, DatabaseChangeLog databaseChangeLog, Database database)

private static void
revertIgnoreOriginalSplitStatementsFlag(ChangeSet changeSet, List<AbstractSQLChange> changes)

This method reverses flag ignoreOriginalSplitStatements on the AbstractSQLChange list and clears the changeset calculated checksum so it is recalculated when it's used again

private static void
setUp421xChecksumFlagForCreateFunctionChange(List<Change> changes, boolean set)

AS we don't have core here, we use reflection to call this method that changes the checksum behavior for this specific class.

private static boolean
validateAbstractSqlChangeV8ChecksumVariant(ChangeSet changeSet, RanChangeSet ranChangeSet)

AbstractSqlChange checksum had the checksum calculated value changed for Liquibase versions 4.19.1 to 4.23.1 due to some changes on the way that we call it when using runWith="anything".

private static boolean
validateCreateFunctionChangeV8ChecksumVariant(ChangeSet changeSet, RanChangeSet ranChangeSet)

CreateFunctionChange checksum had the calculated value changed for Liquibase versions 4.21.X due to incorrect annotations being added to CreateProcedureChange .

private static boolean
validateMongoDbExtensionIssue(ChangeSet changeSet, RanChangeSet ranChangeSet, DatabaseChangeLog databaseChangeLog, Database database)

MongoDB's extension was incorrectly messing with CreateIndex and DropIndex checksums when the extension was added to the lib folder but a database other than mongodb was used.

private static boolean
validateSqlFileChangeAndExpandExpressions(ChangeSet changeSet, RanChangeSet ranChangeSet, Database database)

returns true iff the changeset's checksum was incorrect due to SQLFileChange doing property substitution on the contents of an external SQL file.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

ValidatingVisitorUtilback to summary
private ValidatingVisitorUtil()

Method Detail

checkLiquibaseVersionIsback to summary
private static boolean checkLiquibaseVersionIs(String version, int major, int minor)
checkLiquibaseVersionMinorThanback to summary
private static boolean checkLiquibaseVersionMinorThan(String version, int major, int minor)
generateNewChangeSetback to summary
private static ChangeSet generateNewChangeSet(DatabaseChangeLog databaseChangeLog, Change originalChange, Change newChange, ChangeSet changeSet)
isChecksumIssueback to summary
public static boolean isChecksumIssue(ChangeSet changeSet, RanChangeSet ranChangeSet, DatabaseChangeLog databaseChangeLog, Database database)
revertIgnoreOriginalSplitStatementsFlagback to summary
private static void revertIgnoreOriginalSplitStatementsFlag(ChangeSet changeSet, List<AbstractSQLChange> changes)

This method reverses flag ignoreOriginalSplitStatements on the AbstractSQLChange list and clears the changeset calculated checksum so it is recalculated when it's used again

setUp421xChecksumFlagForCreateFunctionChangeback to summary
private static void setUp421xChecksumFlagForCreateFunctionChange(List<Change> changes, boolean set)

AS we don't have core here, we use reflection to call this method that changes the checksum behavior for this specific class.

validateAbstractSqlChangeV8ChecksumVariantback to summary
private static boolean validateAbstractSqlChangeV8ChecksumVariant(ChangeSet changeSet, RanChangeSet ranChangeSet)

AbstractSqlChange checksum had the checksum calculated value changed for Liquibase versions 4.19.1 to 4.23.1 due to some changes on the way that we call it when using runWith="anything". This method validates the v8 checksum using the alternative algorithm as a way to allow users to upgrade to checksums v9 without facing any errors or unexpected behaviours. To accomplish that it will check for: * do we have runWith set? * are we working with a v8 checksum? * does this change extends from AbstractSQLChange? * Changing splitStaments makes it work?

validateCreateFunctionChangeV8ChecksumVariantback to summary
private static boolean validateCreateFunctionChangeV8ChecksumVariant(ChangeSet changeSet, RanChangeSet ranChangeSet)

CreateFunctionChange checksum had the calculated value changed for Liquibase versions 4.21.X due to incorrect annotations being added to CreateProcedureChange . This method validates the v8 checksum using the alternative algorithm as a way to allow users to upgrade to checksums v9 without facing any errors or unexpected behaviours.

validateMongoDbExtensionIssueback to summary
private static boolean validateMongoDbExtensionIssue(ChangeSet changeSet, RanChangeSet ranChangeSet, DatabaseChangeLog databaseChangeLog, Database database)

MongoDB's extension was incorrectly messing with CreateIndex and DropIndex checksums when the extension was added to the lib folder but a database other than mongodb was used. This method checks: * is it a CreateIndex or DropIndex change? * are we not using mongo? * do we have mongo extension loaded? * If I use CreateIndex or DropIndex from mongo extension, does the checksum matches? If everything matches than we fix the checksum on the database and say it's fine to continue.

validateSqlFileChangeAndExpandExpressionsback to summary
private static boolean validateSqlFileChangeAndExpandExpressions(ChangeSet changeSet, RanChangeSet ranChangeSet, Database database)

returns true iff the changeset's checksum was incorrect due to SQLFileChange doing property substitution on the contents of an external SQL file. If it returns true, the changeset's checksum has been fixed.