3

I’m using Liquibase via the Gradle-Liquibase (v 1.1.1) plugin. I have the following changeset …

<changeSet id="create_my_stored_proc" author="davea" dbms="mysql" runAlways="true">
    <sqlFile endDelimiter="//" path="src/main/resources/scripts/create_my_stored_proc.sql" stripComments="true"/>
</changeSet>

Is it possible to set something such that checksums are ignored for this changeset only? The underlying procedure is in a state of flux that could be repeatedly updated and rather than create a new changeset each time, I would like the existing one to run upon every Liquibase build.

Dave
  • 15,639
  • 133
  • 442
  • 830
  • If you have runAlways="true" attribute for changeset it is applied for each Liquibase run is it what you want to achieve? – dbf Dec 03 '15 at 10:32
  • What I want is for this to be run every time and for checksums to be ignored. Does that make sense? – Dave Dec 03 '15 at 16:08
  • runAlways="true" runs it every time and checksum is not checked. I see that you already added it so asked for details. – dbf Dec 03 '15 at 17:35

4 Answers4

3

You can disable the checks per changeSet using the <validCheckSum> tag with known good values.

For example, if the previous changeset had a checksum like 8:b3d6a29ce3a75940858cd093501151d1 and you wanted to tweak that changeSet (but not re-apply it where this step has already succeeded) then you could use something like this:

<changeSet author="me" id="mychangeset">
  <validCheckSum>8:b3d6a29ce3a75940858cd093501151d1</validCheckSum>
  <sqlFile ... />
</changeSet>
lmsurprenant
  • 1,723
  • 2
  • 14
  • 28
2

"RunAlways will still throw a checksum error by default, but you can always use runOnChange=true or any to change that."

Have a look at this ticket raised in liquibase: https://liquibase.jira.com/browse/CORE-2506

So, you could do:

<changeSet id="create_my_stored_proc" author="davea" dbms="mysql" runAlways="true">
    <validCheckSum>any</validCheckSum>
    <sqlFile endDelimiter="//" path="src/main/resources/scripts/create_my_stored_proc.sql" stripComments="true"/>
</changeSet>
Rodrigo Ibañez
  • 129
  • 2
  • 5
1

Today validCheckSum is available in XML/SQL/YAML. You might set a hash, reported by validate command or use universal magical hash 1:any to skip hash check for the changeset.

gavenkoa
  • 45,285
  • 19
  • 251
  • 303
0

You can add the runAlways and/or runOnChange attributes.

SteveDonie
  • 8,700
  • 3
  • 43
  • 43