I am using Liquibase and would like to execute the same script in two different variants (production and tests):
<changeSet author="..." id="...">
<insert tableName="...">
<column name="ACTIVE" value="${isActive}" />
</insert>
</changeset>
Currently, I use a property to steer this in two files:
<!--File1: For production -->
<property name="isActive" value="true"/>
<!--File2: For tests-->
<property name="isActive" value="false"/>
Is there a way to use something like a profile (as in Maven) or use command line arguments in Liquibase? I would like to avoid the handling of two different files, one for the production and one for the test systems.
You may specify context
parameter for property or changeSet itself:
<property name="isActive" value="true" context="prod"/>
<property name="isActive" value="false" context="test"/>
Then pass the context parameter to liquibase in some way:
mvn liquibase:migrate -Dliquibase.contexts=prod
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With