Liquibase checksum validation error without any changes

匿名 (未验证) 提交于 2019-12-03 01:47:02

问题:

Maven fires liquibase validation fail even no changes was made in changeset.

My database is oracle.

Situation:

  1. In DB changelog table was record for changeset ;

  2. Then by mistake i added another changeset

  3. Reruned liquibase scripts Maven fired checksum validation error.

  4. Then i changed hsqldb changeSet to

  5. Maven still firing checksum validation error.

  6. 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:

  1. Important!, liquibase has a liquibase has a changlog.xml file
  2. 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.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!