Usage
The Flyway migration action supports the Flyway migrate command that is available in the Flyway Community edition (this action should work in Redgate’s commercial editions of Flyway, but has only been tested in the Community edition).
Flyway uses a database connection and configuration of its own in the background.
This requires you to copy the JDBC driver for your database to <PUTKI>/plugins/actions/flyway/lib.
Configuration
Option | Description |
Flyway migrate | The name to use for this action |
Connection | The relational database connection to use for this action |
SQL Folder | The SQL Folder to read migration files from (only a single folder is currently supported). |
Allow out-of-order migration files? | By default, Flyway migrations are executed in the order determined by the naming convention. This option allows to run migration files that do not follow this naming convention. |
Nb connection retries | The maximum number of retries when attempting to connect to the database. After each failed attempt, Flyway will wait 1 second before attempting to connect again, up to the maximum number of times specified by connectRetries. The interval between retries doubles with each subsequent attempt. Check the Flyway docs for more information. |
Nb lock retries | At the start of a migration, Flyway will attempt to take a lock to prevent competing instances executing in parallel. If this lock cannot be obtained straight away, Flyway will retry at 1s intervals, until this count is reached, at which point it will abandon the migration. A value of -1 indicates that Flyway should keep retrying indefinitely. Check the Flyway docs for more information. |
Further Reading
Check the Flyway docs for more information about migrations and the required naming conventions.
NOTE: the undo migrations mentioned in the docs are part of the commercial editions of Flyway and are currently not supported.
The naming conventions used by Flyway are
Versioned Migrations
Prefix Separator Suffix
V2__Add_new_table.sql
For example:
➜ ls -l sql total 2 -rw-r--r--@ 1 user group 184B Oct 15 14:30 V1__create_table_car.sql -rw-r--r--@ 1 user group 192B Oct 15 14:33 V2__alter_table_car.sql |
Note: For a practical example of using the Flyway migrate transform, refer to the sample provided.