12

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:

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:

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

tkruse
  • 10,222
  • 7
  • 53
  • 80

4 Answers4

26

You could also use the <validCheckSum> sub-tag of the <changeSet> to add the new checksums as valid checksums.

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.

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.

Jens
  • 6,243
  • 1
  • 49
  • 79
6
mvn liquibase:clearCheckSums

Will clear the checkSums

Sreedhu Madhu
  • 2,480
  • 2
  • 30
  • 40
3

Clearing the checksums would be any use for you? Of course they are going to be recalculated . See related question here. Hope that helps

Community
  • 1
  • 1
javapapo
  • 1,342
  • 14
  • 26
  • how many environments do you have? 3, 4,5 liquibase does everything - you just apply a single command! – javapapo Jan 07 '16 at 13:52
  • Liquibase exists in all these envs so you need to handle this case in each env eventually. Either with a liquibase specific command or fiddle around the rdbms and apply on your own changes to the liquibase tables . What about a small script , configurable with the db schema name and credentials that you could distribute to the team. the script would invoke liquibase for example . – javapapo Jan 07 '16 at 14:25
3

Using gradle ./gradlew liquibaseClearChecksums

user672009
  • 4,379
  • 8
  • 44
  • 77