according to https://docs.liquibase.com/concepts/changelogs/property-substitution.html:
Note that Liquibase obtains the checksum of a sql changeset after substituting any properties you specify. However, it obtains the checksum of a sqlFile changeset before substituting the properties in the external SQL file.
but this does not appear to be true in 4.22+. I have an sqlFile changeset which uses the ${database.liquibaseSchemaName}
property. I have an integration test which compares the checksum of this changeset in two different schemas:
@Test fun `test that all changesets have the same checksums in different schemas`() { /* * One way that a changeset can have different checksums in different schemas * is if the changeset has a .xml file with an <sql> tag that uses * the ${database.liquibaseSchemaName} variable. To fix that problem, * the SQL statements in the <sql> tag must be moved to a .sql file * that is referenced in a <sqlFile> tag in the .xml file. */ schemaService.initSchema(schema1, userId, true, true) schemaService.initSchema(schema2, userId, true, true) val liquibase1 = liquibaseFactory.createLiquibase(schemaNamingStrategy.toStarSystemSchemaName(schema1)) val liquibase2 = liquibaseFactory.createLiquibase(schemaNamingStrategy.toStarSystemSchemaName(schema2)) val changeSets1 = liquibase1.databaseChangeLog.changeSets val changeSets2 = liquibase2.databaseChangeLog.changeSets for (i in 0..changeSets1.size-1) { val checksum1 = changeSets1[i].generateCheckSum(ChecksumVersion.V9) val checksum2 = changeSets2[i].generateCheckSum(ChecksumVersion.V9) if (checksum1 != checksum2) { Assert.fail("changeSet ${changeSets1[i].filePath}:${changeSets1[i].id} differs between schemas") } } println("done") }
With liquibase 4.21.0, this test passed, but with subsequent releases, it fails.