Dave
Dave

Reputation: 19150

Can Liquibase ignore checksums for a single changeset?

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.

Upvotes: 4

Views: 9017

Answers (4)

gavenkoa
gavenkoa

Reputation: 48813

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.

Upvotes: 2

Rodrigo Iba&#241;ez
Rodrigo Iba&#241;ez

Reputation: 159

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

Upvotes: 3

lmsurprenant
lmsurprenant

Reputation: 1925

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>

Upvotes: 3

SteveDonie
SteveDonie

Reputation: 9016

You can add the runAlways and/or runOnChange attributes.

Upvotes: 0

Related Questions