Updating Liquibase core from 3.10.2 to 4.X

Hi,

We are trying to update the Liquibase core (3.10.2) in our Spring Boot (version 2.7.6) to 4.X preferably 4.8.0.

1.) First we cleared the checksums in the Databasechangelog table
2.) Updated the Liquibase version in the Databasechangelog table
3.) Then updated the version in pom
4.) Then packaged and deployed

While starting the app, the Liquibase is trying to run the old changelogs and because of which we are getting SQL exceptions like “Object already exists” and due to which the app is getting failed to start.

Any help would be highly appreciated pls

There should be no need to cleacksums or update the liquibase version in the databasechangelog table when you upgrade liquibase.

The main thing to pay attention to is the “filename” field in the databasechangelog, since 4.x prefers a relative path.

I upgrade from 3.10.2 to 4.9.0 and didn’t have any issues.

Hi @daryldoak

Thanks for the reply. Yes I agree, we don’t need to do any changes to the DATABASECHANGELOG. But I didn’t work for us when we just update the version of Liquibase core in pom.xml

We went ahead with a quick dirty fix, like

1.) Pick a fresh and clean DB and run the code with updated liquibase
2,.) It applies all the change log and generates the DATABASECHANGELOG table
3.) Take a backup of that table DATABASECHANGELOG
4.) Now go to the primary DB and truncate the existing DATABASECHANGELOG and generate the table again using the backup from step 3
5.) Then now deploy the new code with updated liquibase

This worked perfectly and even after this we tried to evolute the schema by introducing a new changelog and liquibase applied it perfectly.

I think overall we observed that we need to something with MD5 CHECKSUM.

Regards
Senthil

Did you compared the ID, AUTHOR, and FILENAME keys between the two tables?

Hi @daryldoak

Yes. The ID and AUTHOR looks similar but the filename is different

3.10.2 has something like this “classpath:liquibase/sqlserver/…/common/2022-03-03.xml”
4.8.0 has something like this “liquibase/common/2022-03-03.xml”

That is what I expected. The handling of filename path is the major difference from 3.x to 4.x. You might consider a one-time update of the databasechangelog table to update the filename field to the proper 4.x version.

1 Like

Thanks @daryldoak , Sure will give it a try and update you