Editing existing changeset- adding valid checksum

My changeset is written in SQL format. I want to add a valid checksum in changeset as I have changed the existing changeset which already got an entry in dbchangelog table.

When I am adding checksum in changeset ,it generates a new checksum in console and shows a mismatch as it is including the checksum as a part of query to calculate new checksum.

Can you pls help me with correct format and location to add checksum.

Can you post the change set here so I can get a better idea of what’s happening?

Hey @ravisharma_raj are you still having the issue? Would you mind posting the changeset as @Pete suggested?

Thanks,

Ronak

hi Ronak,

this is the file format i have

–liquibase formatted sql

–changeset Ravi_XYZ-changes:1 --validCheckSum: 8:098f6bcd4621d373cade4e832627b4f6
alter table Employee add isOnLeave BOOLEAN default false after name;

the validchecksum i have added is the checksum which my console shows with a failure (mismatch checksum) . when i add the newly generated checksum i get the same error with new checksum. let me know if you need any other info.

hi Pete,

this is the file format i have

–liquibase formatted sql

–changeset Ravi_XYZ-changes:1 --validCheckSum: 8:098f6bcd4621d373cade4e832627b4f6
alter table Employee add isOnLeave BOOLEAN default false after name;

the validchecksum i have added is the checksum which my console shows with a failure (mismatch checksum) . when i add the newly generated checksum i get the same error with new checksum. let me know if you need any other info.

Thanks for the response. I performed some tests with a similar configuration and I think you have the right of it: when the validCheckSum attribute is added to the changeset, it impacts the checksum created for the file on the next run of liquibase so a match can’t be made.

This looks to be a bug with the software. I was working with Liquibase 3.10.0. I would encourage you file an issue in GitHub so we can get it in the queue and addressed: https://www.liquibase.org/community/contribute/report-bugs

Sorry you hit an issue. Thanks for letting us know.

Sure will log an issue, one more general question I have , if we write changeset in SQL format, then we may get into issues when we migrate to some other hetrogenous db? As SQL format is not platform agnostic. Is my understanding correct. What format you recommend for changeset , SQL or xml.

It really depends on what you plan to do.

If your plan is to have a single changelog for multiple database platform types it is best to use XML, JSON or YAML. With these types, Liquibase will generate the appropriate SQL at runtime to update the database.

If you are only writing or planning to implement for a single database platform type, you may use the either structured changesets (XML) or plain old SQL to similar effect.

It sounds like you may have plans to switch databases in the future. If that’s the case I’d go with XML.

1 Like

Hi

@ravisharma_raj did you resolve the issue ?
I tried with postgresql when I had updated the file. I added both checksums into sql script as an option and was able to correctly run modified changelog

–validCheckSum: 8:b961461e029c32e40b8b09f1df65a05e
–validCheckSum: 8:6f9eea05e3ed5c2fc4fa1f9f45159281

another option is to use clearCheckSums command to force liquibase to recompute the checksum at next run.

2 Likes