After db upgrade getting liquibase checksum validation error

Viewed 925

I upgrade my PostgreSQL from version 9.6 to 12 and I'm using Liquibase 3.8.0 via Spring.

After the db upgrade when I start my app, I got the following Liquibase exception for the first changeset:

Caused by: liquibase.exception.ValidationFailedException: Validation Failed:
     1 change sets check sum
          db.liq.xml::1555784288321-4::myuser was: 8:9df75f119833ded8765efcc910ffa071 but is now: 8:57040acff0d316c100c788531a84ae8b

Now the current changeset is set with the onValidationFail="MARK_RAN" tag so it shouldn't fail but still I'm getting this exception..

 <changeSet author="myuser" id="1555784288321-4" onValidationFail="MARK_RAN">

I can solve this specific exception by setting the <validCheckSum> tag but I think that I will get the same exception for other changesets. The only thing that I did was upgrade my Postgres database.

Now, is liquibase using the database's function hash? If yes then it can explain this behavior but it seems unlikely otherwise after each major upgrade or every time the db will update its hash function Liquibase will behave like this.

1 Answers

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.

Related