Occasionally we may discover a bug introduced by a bad changeset, and want to fix the changeset so that people who upgrade in the future don't run into this. This is possible, but it's important to follow the correct process.
The reason we have to do this is that liquibase keeps checksums of all changesets that have ever been run on your database, so if you modify a changeset after anybody has run it, that user will get an error and be unable to start OpenMRS the first time they try to run an OpenMRS version with the modified changeset. The workaround is to explicitly list all valid checksums, so that things don't break for people who already ran the old version of the changeset. (Note: this will not re-run the new changeset for people who ran the original one. Depending on the bug you're trying to fix, you may also need to add a new changeset to clean up after the original version of the old one.)
What to do:
- Find the changeset you'd like to modify in liquibase-update-to-latest.xml. Make your change, and restart OpenMRS.
- You will see an error message like this
Error occurred while trying to get the updates needed for the database. Validation Failed: 1 change sets check sum liquibase-update-to-latest.xml::20101209-1723::wyclif::(MD5Sum: 4d67c48557f5665a8c2be7e87e22913)
- Note down the MD5Sum that is reported. This is the checksum for the new version of the changeset. (In this case it is "4d67c48557f5665a8c2be7e87e22913".)
- Look in the liquibasechangelog table in your database for the checksum of the old version of the changeset. For example
select md5sum from liquibasechangelog where id = '20101209-1723'
- Go back to the changeset in liquibase-update-to-latest.xml and add a validCheckSum subtag for both the old and new checksums, making sure to comment them. For example:
<changeSet id="20101209-1723" author="wyclif">
<validCheckSum>db17937286d48f680b2be16bee24e62</validCheckSum> <!-- old checksum without specifying date_created -->
<validCheckSum>4d67c48557f5665a8c2be7e87e22913</validCheckSum> <!-- current checksum with date_created property added -->