How to run a script on every deploy
beerbox
Posts: 1 New member
Hi, we use Flyway and TeamCity to run/deploy sql scripts to a Oracle database. We use the R__ prefix for Repeatable deployements, IE the file is run if it's seen by Flyway for the first time, or if the file is changed. However, I would like some files to be run every time, regardless if it's changed or not. These kind of files should be identified by its prefix, or a config file if possible..
Answers
This is possible, there are two possible ways to achieve this.
1. Callbacks are the preferred mechanism as it gives you timing granularity. As you can see from the linked list, you can trigger arbitrary code exactly when you want it.
2. You can overcome the repeatable migration safety feature by adding a variable to it that ensures the script checksum will always be different. An example of this is detailed here.
https://flywaydb.org/blog/flyway-timestampsandrepeatables