Pre- and Post-migration scripts for Flyway

后端 未结 2 1113
轮回少年
轮回少年 2020-12-19 05:54

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:

  1. Dro
2条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-19 06:30

    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.

提交回复
热议问题