0
votes

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

2

2 Answers

1
votes

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?

0
votes

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.