enigma
enigma

Reputation: 31

Environment Specific Flyway Migration Versioning

I am using flyway for database migration. I need to use it across different environment (qa, demo, prod) so have created a base folder (which runs all migrations) and environment specific folders. Now based on the environment (configured as application variable read on application startup), the specific folder is picked up and the migrations in base and the environment specific folder are run.

The problem i face is versioning. Say current version of base folder is X. If i want the next migration to be environment specific I give it X+1. But this might be on a certain environment only (say demo, not on qa and prod). So the sequence of migrations is irregular across environments. The workaround can be a dummy migration (in qa and prod) to keep sequence regular, but this creates another constraint on the developer who now needs to check in both base and env. folder for the latest number. (will get worse with branches merging). Another suggestion would be to begin the environment specific migration from a specific number (large). This will allow user the proceed with the regular numbering in base and keep on incrementing to large number in environment specific folder.

But I am still not convinced this is a good way.

Are there any better ways to do maintain versioning across environments which would not require much effort (newer version can be added just by seeing last in that folder)

Upvotes: 0

Views: 754

Answers (1)

Axel Fontaine
Axel Fontaine

Reputation: 35179

Use X.1 instead of X+1. Nice and easy, and doesn't disturb your existing numbering.

Upvotes: 1

Related Questions