How to update checksum of an existing changeset?

Hello,
I use Liquibase 4.14.0 (the only version that works for me because of other issues).
I have a changeset as an .sql file with Liquibase header. It was already applied and registered in DATABASECHANGELOG database before.
Now I changed the changeset and manually applied the .sql file to my database, without the use of Liquibase. (I know it does not correspond to best practicies of Liquibase, but this is real life situation).
I want to update the checksum of my registered changeset, so that it is not applied again when I execute update command next time. What Liquibase command should I use?
I tried changelog-sync and mark-next-changeset-ran, but both commands seems to work with new changesets only. If changeset is already registered, both commands just skip it.
Of course, I can manually delete the registration of my changeset from DATABASECHANGELOG and the use any of the commands above. But it would be great to have a ‘legal’ way to update the checksum with direct access to the registration table.
Any idea?

I would recomment to add “runOnChange=true” to the changeset, modify the changeset, then use Liquibase to apply (update command), instead of running manually. This will cause Liquibase to recalculate the md5sum in the databasechangelog table for that changeset.

Alternatively, you could update the md5sum to NULL on the 1 row in the databasechangelog table, which will cause Liquibase to recalculate it on next update.

Hi Daryl, thank you for your quick response!
Yes, when “runOnChange=true” it registers the checksum.
However this is not an ideal solution for us, because the script fails and then updates the checksum (what is not expected). We see failure in the logs on test environment and do not allow such scripts to run on production. So, the DATABASECHANGELOG on production still have an old checksum and will attempt to install the failed script if the script is available to production Liquibase.

Currently we work out the following solution:

  • increase changeset id,
  • temporary add an exception for this file in VCS Trigger, and
  • run changelog-sync command to update the checksum.

Because the key (filepath + author + id) is different now, Liquibase makes a new record with new checksum for the changeset and does not run it until the script changed.
This is not ideal also, becuase it requires an extra change of changeset id and making exception for VCS Trigger.
So it would be nice to have an option to update checksum of an existing changeset using a Liquibase command.

Boris.

I would have added a precondition, and use MARK_RAN to handle such a situation. Since you have already increased the changeset id, this is no longer considered to be the same changeset by liquibase, it is identified as a new changeset.