Liquibase equivalent of beforeEachMigrate in Flyway

Viewed 16

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
2 Answers

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.

Related