Maven fires liquibase validation fail even no changes was made in changeset.
My database is oracle.
Situation:
In DB changelog table was record for changeset <changeSet id="1" author="me" dbms="oracle">
;
Then by mistake i added another changeset <changeSet id="1" author="me" dbms="hsqldb">
Reruned liquibase scripts Maven fired checksum validation error.
Then i changed hsqldb changeSet to <changeSet id="2" author="me" dbms="hsqldb">
Maven still firing checksum validation error.
Then i changed first changeSet checksum in DB manually to current checkSum and scripts runned successfully.
Everything looks nice ,but when i redeploy whole application and run liquibase scripts checksum of first changeSet is still like before 6 step.
Running the clear-checksums command To run the clear-checksums command, specify the database driver, classpath, and URL the Liquibase properties file. For more information, see Specifying Properties in a Connection Profile. You can also specify these properties in your command line.
When running the calculate-checksum command, the DATABASECHANGELOG table calculates an MD5 checksum for each entry based on the SQL script of the changeset. This checksum helps Liquibase detect differences between the changesets you want to deploy and the changesets that have already been run against the database.
In order to detect changes between what is currently in the changelog vs. what was actually run against the database, Liquibase stores a checksum with each changeset entry in the DATABASECHANGELOG tracking table.
If you're confident that your scripts correctly reflect what should be in the database, run the liquibase:clearCheckSums maven goal, which will clean it all up.
Checksum validation errors are thrown by liquibase to indicate that the changes applied to the database no longer match the same content specified within the liquibase changeset files....
This is a safety measure designed to detect mis-behaving specification files and can easily happen during development. The best way to fix the problem is drop all objects and run liquibase against the development environment fresh as follows:
mvn liquibase:dropAll liquibase:update
Warning - this will drop all objects in the schema. You will lose all data in tables, and any object not managed by Liquibase. Documentation for drop-all goal
Sometimes you actually want to support changing changesets. In those circumstances liquibase supports a "runOnChange" attribute which selectively applies the changesets against the database instance.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With