33

How can I disable checksum validation in Liquibase?

It looks like Liquibase does not provide such feature. Would it be hard to modify Liquibase to achieve that? Your opinion, please.

anton1980
  • 979
  • 3
  • 10
  • 20
  • Maybe this helps? http://stackoverflow.com/questions/9995747/liquibase-checksum-validation-error-without-any-changes – Marvin Jun 01 '15 at 17:29
  • thank you, Marvin. that solution would work, but we integrate Liquibase in our Spring applications. what we want to do is ignore the checksums when the app is deployed on a server. at that time, there is no Maven. – anton1980 Jun 01 '15 at 17:33
  • 1
    Why would you want to disable checksums? They're a very important feature in liquibase designed to protect against applying a changeset more than once to a database instance. Yes, the clearCheckSums command is provided but this is a feature designed to recover from abnormal behaviour, for example when someone changes a changeset.... See what I mean? normally a changeset should not be changed. That is an example of how the use of checksums protects your production database. – Mark O'Connor Jun 01 '15 at 18:01
  • 1
    Mark, I understand the purpose of checksums and their importance. Still we want to disable them for our projects. That's what's best for us. – anton1980 Jun 01 '15 at 19:13
  • Is this about deployment or validation at startup? Some apps are doing an initial validation on database before starting. – silmx Nov 13 '15 at 00:25
  • @anton1980 you have to accept chris's answer – Andremoniy May 05 '17 at 08:57

1 Answers1

63

Try adding validCheckSum with the literal ANY to the top of your changeSet, like this:

<changeSet>
    <validCheckSum>ANY</validCheckSum>
    <!-- the rest of your changeSet here -->
</changeSet>
chris
  • 2,467
  • 2
  • 25
  • 25
  • 9
    It must be the literal ANY – chris Feb 07 '17 at 14:56
  • this works for Liquibase 3, but not Liquibase 2. we asked this question for Liquibase 2 and ended up modifying its code to achieve similar results. – anton1980 May 07 '17 at 11:04
  • 5
    Note that during development it might be tempting to use `ANY` but you are asking for trouble in the future it gets left in. It is a good idea to use the actual checksum instead of `ANY`. – span Sep 08 '17 at 05:18
  • @span we use it at my company for our csv loads so we don't have to add a new file for each update to a large list of values. Without this, adding a value to a long csv would fail the checksum making re-use not an option. In almost all cases that I can think of except the one I mentioned, I agree with you that it is bad to use ANY as a checksum. – Andrew Cotton Mar 04 '19 at 23:56
  • If you use .groovy files for liquibase, you can write : validCheckSum('ANY') – Skirlyx Jun 13 '23 at 03:36