可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
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
;
Then by mistake i added another changeset
Reruned liquibase scripts Maven fired checksum validation error.
Then i changed hsqldb changeSet to
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.
回答1:
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.
回答2:
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
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.
回答3:
As I struggle with this one I want to make it easier for people with this same issue:
- Important!, liquibase has a liquibase has a changlog.xml file
- On the maven pom.xml place the following properties.
org.liquibaseliquibase-maven-plugin*****src/main/resources/mychangelogfile.xmloracle.jdbc.driver.OracleDriverjdbc:oracle:thin:@//X.X.X.X:PORT/XEyourusernamepasswordclearCheckSums
**** version the one I used 3.2.0 in url replace with proper IPADDRESS and PORT.
Finally you run mvn liquibase:clearCheckSums
Hope it helps!
回答4:
In my case I forgot that Liquibase writes all chagelogs to database table.
Go to DATABASECHANGELOG table and remove manually your chagelogs.