How to Solve Liquibase Checksum Validation Fail After Liquibase Upgrade

How to solve liquibase checksum validation fail after liquibase upgrade

You could also use the <validCheckSum> sub-tag of the <changeSet> to add the new checksums as valid checksums.

Also, checkout the comments on the bug CORE-1950. You could put the log level to "debug" on both of your liquibase versions and see if you can find differences in the log output of the checksum creations.

Use subtag something like this

<changeSet id="00000000000009" author="system">
<validCheckSum>7:19f99d93fcb9909c7749b7fc2dce1417</validCheckSum>
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">SELECT COUNT(*) FROM users</sqlCheck>
</preConditions>
<loadData encoding="UTF-8" file="users.csv" separator=";" tableName="users">
<column name="active" type="boolean" />
<column name="deleted" type="boolean" />
</loadData>
</changeSet>

You should remember that the value of the validCheckSum tag is the new checksum for the changeset.

Liquibase checksum validation error without any changes

If you're confident that your scripts correctly reflect what should be in the database, run the liquibase:clearCheckSums maven goal, which will clean it all up.

After db upgrade getting liquibase checksum validation error

You can always use clearCheckSums feature. It will clear existing checksums and recalculate them without running your changeSets.

In order to run clearCheckSums you can use maven goal:

https://www.liquibase.org/documentation/maven/maven_clearchecksums.html

or Liquibase command line:

https://www.liquibase.org/documentation/command_line.html

Another option (bad one):

you can add <validCheckSum>ANY</validCheckSum> to your changeSets.

It'll solve the issue, but you'll loose control of changes inside already executed changeSets. So it's NOT a good thing to do.

ValidationFailedException after Liquibase update to 4.9.1

You can update your changeset and add validCheckSum tag with the new value of the checksum. This way validation will pass, and changeset will still be deemed as executed on the existing databases. Check out the docs from Liquibase.

How can I force Liquibase to recalculate checksums without re-running the statements?

Rather than clearing the checksums yourself using SQL, it will probably be better to let Liquibase do that by using the clearCheckSums command:

https://docs.liquibase.com/commands/community/clearchecksums.html

Removes current checksums from database. On next run checksums will be recomputed.

How to fix ValidationFailedException in liquibase checksum?

Yeah, you can't really do that. Once you've applied a changeset it records the checksum in the config database, any changes (even whitespace) will cause this validation error. If you're using maven or gradle you can clear the checksums and they will be recomputed on the next run by using the clearChecksums goal on the liquibase plugin.

You should pay close attention, when you use the SQL option (via <include file=" I presume), it DOES NOT differ the checksum on whitespace so there are probably other differences that you are not seeing. If you're confident that the changes are inconsequential, add

--validCheckSum 8:47d241e6e1636203501ec72cafe4e5b6

to the header of your SQL file and this will tell liquibase that even though the original checksum was calculated as 8:600cf084d9c1ea85df2ddaa4f7a8a309, 8:47d241e6e1636203501ec72cafe4e5b6 is also a valid checksum for this file.

Some good advice would be to have tighter control of these files using your RCS, otherwise you're going to be constantly fighting with this.



Related Topics



Leave a reply



Submit