5

We would like to use Flyway for database migrations. In addition to our migration scripts, we have a need to execute some scripts that should not be treated as migrations (and do not need to be tracked in the schema_version table). An example would be to execute scripts that contain configuration data or test data that is only relevant in development environments. We would still like to use the flyway-maven-plugin to execute these SQL scripts rather than a different maven plugin that runs before/after my flyway-maven-plugin.

A similar question was asked about pre and post migration scripts for flyway. If this feature was implemented, it could work for our needs as well.

Community
  • 1
  • 1
Tim Andersen
  • 344
  • 3
  • 7

2 Answers2

4

With Flyway's support for loading scripts from multiple locations, you configure in such a way that it only loads a set of reference or test data in certain environments, but not in others.

You will have to give these scripts a version, but that shouldn't be too much of an issue as they depend on the underlying DB structure being present anyway.

Axel Fontaine
  • 34,542
  • 16
  • 106
  • 137
1

For system data, that have to be in the database, like lookup tables for examples, these may be handled by normal migration scripts. The reasoning is that they go hand in hand with the database structure and the application code. You may use a naming convention to easily distinguish system data scripts from DDL scripts.

For test data, you may want to consider using the flyway-test-extentions.

Mohamed Ragab
  • 539
  • 3
  • 7