Reputation: 560
I need to have specific migration to be run for some tests. So I would like to separate this test migration from other migrations. I was thinking to make second liquibase master file (test/resources/db/liquibase-master.xml) that includes first one + migration that i need only for tests. I'm not sure if this is even possible. Is this the right way to go, or is there another better way?
Upvotes: 0
Views: 1042
Reputation: 1625
Here below the way of achieving what you need with 1 single master file and using contexts. And the doc about it : https://www.liquibase.org/documentation/contexts.html
Dev configuration : src/main/config/application-dev.yml
liquibase:
contexts: dev
Test configuration : src/test/config/application.yml
liquibase:
contexts: test
ChangeSet example : ChangeSet_xxx_.xml
<changeSet id="x1" context="dev">
<!-- Executed in dev context only -->
</changeSet>
<changeSet id="x2" context="test">
<!-- Executed in test context only -->
</changeSet>
<changeSet id="x3" context="test,dev">
<!-- Executed in both contexts -->
</changeSet>
Upvotes: 1