Java liquibase升级后如何解决liquibase校验和验证失败
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/34655157/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to solve liquibase checksum validation fail after liquibase upgrade
提问by tkruse
In my project I just tried upgrading liquibase from 3.2.2 to 3.4.2 (both the jars and the maven plugin). EDIT: same for upgrade to 3.3.x. As a consequence, starting the application now gives the following error:
在我的项目中,我只是尝试将 liquibase 从 3.2.2 升级到 3.4.2(jar 和 maven 插件)。编辑:升级到 3.3.x 也是如此。因此,现在启动应用程序会出现以下错误:
Caused by: liquibase.exception.ValidationFailedException: Validation Failed:
4 change sets check sum
src/main/resources/changelogs/xxx_add_indices_to_event_tables.xml::xxx-add_indices_to_event_tables::xxx is now: 7:0fc8f1faf484a59a96125f3e63431128
This for 4 changesets out of 50, all of which add indexes, such as:
这适用于 50 个变更集中的 4 个变更集,所有变更集都添加了索引,例如:
<createIndex indexName="idx_eventtype" tableName="events">
<column name="eventtype" type="varchar(64)"/>
</createIndex>
While I can fix this locally, this would be a huge pain to manually fix on all running environments. Is this a bug, or is there some workaround?
虽然我可以在本地修复此问题,但手动修复所有正在运行的环境将是一个巨大的痛苦。这是一个错误,还是有一些解决方法?
采纳答案by Jens
You could also use the <validCheckSum>
sub-tag of the <changeSet>
to add the new checksums as valid checksums.
您还可以使用 的<validCheckSum>
子标签<changeSet>
将新校验和添加为有效校验和。
Also, checkout the comments on the bug CORE-1950. You could put the log level to "debug" on both of your liquibase versions and see if you can find differences in the log output of the checksum creations.
另外,请查看关于错误CORE-1950的评论。您可以将两个 liquibase 版本的日志级别设置为“调试”,看看是否可以在校验和创建的日志输出中找到差异。
Use subtag something like this
使用类似这样的子标签
<changeSet id="00000000000009" author="system">
<validCheckSum>7:19f99d93fcb9909c7749b7fc2dce1417</validCheckSum>
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">SELECT COUNT(*) FROM users</sqlCheck>
</preConditions>
<loadData encoding="UTF-8" file="users.csv" separator=";" tableName="users">
<column name="active" type="boolean" />
<column name="deleted" type="boolean" />
</loadData>
</changeSet>
You should remember that the value of the validCheckSum tag is the new checksum for the changeset.
您应该记住,validCheckSum 标记的值是变更集的新校验和。
回答by javapapo
回答by Sreedhu Madhu
mvn liquibase:clearCheckSums
Will clear the checkSums
将清除校验和