Table of Contents
In this article, We will learn how we can configure repeatable migration in the flyway database migration tool with an example. So many times it needs for us to run the script every time when changes are applied, for example, any changes in store procedure then we like to execute again when the application deployed to the server.
2. Flyway Repeatable Migration Rules
Repeatable migration might be used for:
- Create or Replace store procedure or function
- Every time insert some new record into the table
Rules for Repeatable Migration
- Repeatable migration will execute after executing pending version migration.
- We should be careful about
CREATE OR REPLACEstatement because while executing the second time database will not allow creating same name object (Table, Stored Procedure or Function) we need to use CREATE OR REPLACE statement not only CREATE statement.
In our previous articles, we learned about how we can execute java logic to migration database using Flyway Now lets start about repeatable migrations.
CALLBACK : We can also implement repetable using callback but with specific perpose. here is more details about callback
- Create a
R__so it will be executed rapidly when any changes applied to file, do not write version here. Here is flyway example with spring boot application.
5. Source Code