Reputation: 5565
I am trying to find the Flyway's beforeEachMigrate
equivalent functionality in liquibase. Does liquibase have a way to execute an SQL script before each new migration script is executed?
My current liquibase structure looks like follows.
application.properties file
spring.liquibase.change-log=classpath:db/changelog/changelog-master.yaml
changelog-master.yaml file
databaseChangeLog:
- include:
file: db/changelog/1-initial-schema.sql
- include:
file: db/changelog/2-schema-update.sql
Upvotes: 0
Views: 259
Reputation: 440
Adding onto what @bilak said, you can also set the parameter using runOrder in addition to runAlways.
Documentation: To always run a changeset before OR after an update - runAlways/runOrder - https://docs.liquibase.com/concepts/changelogs/changelog-formats.html
Upvotes: 0
Reputation: 4932
create something like db/changelog/00-init.sql
and put there something like
<changeSet id="1" author="you" runAlways="true">
<sql>...or whatever change</sql>
</changeSet>
note: use runAlways
EDIT: I'm looking into beforeEachMigrate
and it executes change before each let's say changeSet
. There is no equivalent for that in liquibase so far.
Upvotes: 1