liquibase 变更集的错误 md5sum 失败

发布于 2024-11-28 19:05:07 字数 1440 浏览 0 评论 0原文

我们使用的是 liquibase 1.9.5,但我还没有将此视为该版本的已知错误。简而言之,我们成功地为 1.0 版本运行了 liquibase,但在尝试运行具有其他变更集的 1.1 版本时,它错误地抱怨 1.0 变更集的 md5sums。

我们已经在短期内通过将 DATABASECHANGELOG 中的 md5sum 列清空来解决这个问题,但我想知道我是否只是做错了什么。

我们按如下方式组织我们的 liquibase: 我们在每个部署上运行一个主 .xml 文件,该文件仅包含针对我们软件的每个版本的单独文件的命令(按正确的顺序)

<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog/1.9"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog/1.9 http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-1.9.xsd">
    <include file="v1_0.xml" />
    <include file="v1_1.xml" />
</databaseChangeLog>

因此第一个版本仅包含 v1_0.xml,而我们刚刚推出的版本包含我们上面有什么。

v1_0.xml 文件在版本之间没有变化,但是在尝试为新版本调用 liquibase 时出现以下错误:

SEVERE: Validation Failed:
     1 change sets check sum
      v1_0.xml::foo_schema::bdeacon::(MD5Sum: ff63b8d1739e6cf1dcaed6a0ef585257)

有问题的变更集:

<changeSet author="bdeacon" id="foo_schema">
    <preConditions onFail="MARK_RAN">
        <not><tableExists tableName="some_table"/></not>
    </preConditions>
    <sqlFile path="database/initial/foo-schema.sql" />
</changeSet>

引用的 foo-schema.sql 文件在版本之间也没有变化。 (它为我们初始创建了整个数据库模式,然后包括前提条件中提到的“some_table”。)

我希望 liquibase 不希望我们手动将 validCheckSum 元素添加到版本之间的每个变更集中...

We are using liquibase 1.9.5, but I haven't seen this as a known bug for that version. The short story is we successfully ran liquibase for our 1.0 release, but it errors out complaining about the md5sums of the 1.0 changeSets when trying to run our 1.1 release that has additional changeSets.

We've worked around it in the short term by just nulling out the md5sum column in DATABASECHANGELOG, but I'm wondering if I'm just doing something wrong.

We organize our liquibase as follows:
One master .xml file that we run on every deployment, which just has commands for a separate file for each version of our software (in the correct order)

<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog/1.9"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog/1.9 http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-1.9.xsd">
    <include file="v1_0.xml" />
    <include file="v1_1.xml" />
</databaseChangeLog>

So the first release only included v1_0.xml, and the release we just pushed out included what we have above.

The v1_0.xml file was unchanged between releases, but we got the following error when trying to invoke liquibase for the new release:

SEVERE: Validation Failed:
     1 change sets check sum
      v1_0.xml::foo_schema::bdeacon::(MD5Sum: ff63b8d1739e6cf1dcaed6a0ef585257)

The changeSet in question:

<changeSet author="bdeacon" id="foo_schema">
    <preConditions onFail="MARK_RAN">
        <not><tableExists tableName="some_table"/></not>
    </preConditions>
    <sqlFile path="database/initial/foo-schema.sql" />
</changeSet>

The foo-schema.sql file referred to was also unchanged between releases. (It does the initial creation of our entire database schema for us, which then includes the "some_table" mentioned in the precondition.)

I would hope liquibase isn't expecting us to manually add a validCheckSum element to every changeSet between releases...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

浅浅 2024-12-05 19:05:07

除非changeSet 或sql 文件的内容发生更改,否则您不需要添加 validCheckSum。

foo-schema.sql 中是否有诸如 SVN 版本号或空格/行结尾之类的内容可能发生变化?

You should not need to add a validCheckSum unless the contents of the changeSet or the sql file changes.

Is there anything such as a SVN version number or whitespace/line endings that may be changing in the foo-schema.sql?

天荒地未老 2024-12-05 19:05:07

您可以将“runOnChange”changeSet 属性设置为 true。在这种情况下,每当变更集引用的任何 sql 文件发生更改时,变更集都将再次运行,并且其校验和将被更新。请参阅 liquibase 文档中的变更集校验和部分。当包/过程/触发代码使用“CREATE OR REPLACE”之类的语句时,它特别有用,在这种情况下,您不需要在调用 sql 文件之前使用 drop 语句来避免“..已经存在”错误。

You can set “runOnChange” changeSet attribute to true. In that case, whenever any sql file that is referenced by changeset is changed that changeset will be run again and its checksum will be updated. See ChangeSet Check Sums section in liquibase doc. It is especially useful when package/procedure/trigger code is using a statement like "CREATE OR REPLACE" in which case you would not need to precede the calls to sql files with drop statements to avoid "..already exists" errors.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文