Search code examples
javaliquibase

Liquibase run changeset every time


I want to insert usernames to the database based on a system property. The system property value can be

users="user1;user2;user3"

This process must be repeatable, meaning that every time the applications is deployed, the migration/changeset must check the system property, and if it has changed and the users are not already in the database it should insert them. In order to achieve this I am thinking of using the customChange tag. But I want this change to run every time the liquibase runs. Is this possible using liquibase or should I create a custom contextLoadListener?


Solution

  • A standard attribute available to all changesets is the runAlways attribute, which should do what you want. There is also a runOnChange attribute available.

    Documentation on the attributes available is here: http://www.liquibase.org/documentation/changeset.html