The runOnChange changeset attribute runs the change the first time it is detected and each time the changeset is modified.

Liquibase determines that a changeset has been modified by comparing the MD5 checksum for the changeset to the checksum stored in the DATABASECHANGELOG table. If the runOnChange attribute is not set or set to false, Liquibase will generate a checksum error if a changeset is modified after it has been deployed to a database. This is done to notify you that a changeset has been unexpectedly modified.


The runOnChange attribute is useful for changesets that you want to run each time they are modified. Common examples are views and stored procedures that use the CREATE OR REPLACE logic. If you copy the entire text of the stored procedure to a new changeset each time you make a change, you not only end up with a lengthy changelog, but you lose the merging and differentiating power of your source control. Instead, place the text of the stored procedure in a changeset with a runOnChange="true" attribute. The stored procedure is recreated only when there is a change to the text.


Note: All changelog attributes use the camelCase format.

The default value for runOnChange is false. Set runOnChange to true on changesets you want to execute whenever they are modified.

SQL example

--changeset runOnChange:true

XML example

<changeSet  author=""  id="changeset01"  runOnChange="true" >
        . . .

YAML example

      id: changeset1
      runOnChange: true
      . . .

JSON example

{ "changeSet" :
        {"id": changeset1,
        "runOnChange": true,
           . . .

Related links