I am looking for a way to execute a hook script before and after migration. I have a bunch of views and stored procedures and would like the process to be:
To expand on Axel's response: callbacks with sql scripts simply means putting beforeMigrate.sql
(for instance, this is one keyword among others) in the directory containing the migrations, and Flyway will execute beforeMigrate.sql
before the other migration scripts. Even before schema_version
gets locked.
Other callback names (e.g. afterMigrate
) are listed in the documentation for callbacks.