Davide Cavestro
Davide Cavestro

Reputation: 497

Does Flyway support defining the list of sql migrations on a file?

In Flyway I was not able to use a file defining the exact ordered set of migration scripts (similar to Liquibase approach).

Is there any way to do so, other than implementing my own MigrationResolver?

Upvotes: 3

Views: 417

Answers (1)

Hamish Carpenter
Hamish Carpenter

Reputation: 851

Flyway does not require you to list your migrations in another file. Instead Flyway migrations are ordered by the version number for versioned migrations and applied in that order. Versioned migrations start with a V by default. Your migrations need to have version numbers according to the sequence they should be applied. This avoids the need to duplicate the sequence in a file by making it explicit in the version number. I recommend leading zeros in your numbers to make them sort nicely on the filesystem too.

For example:

V100__new_feature_a_part_1.sql
V110__new_feature_a_part_2.sql
V111__new_feature_a_part_3.sql
V120__new_feature_b.sql

Upvotes: 2

Related Questions