Can anyone advise if there is a configuration setting for flyway so that it can ignore a certain sql file depending on which environment I am migrating the database in?
I am using the maven flyway plugin and have a number of sql files for eg:
V1.01_schema.sql
V1.02_data.sql
V1.03_testdata.sql
When I move my database into production I do not want to apply the testData.sql file. Any way that I can get it to ignore this file?
Yes, you can define a specific profile that will tell
flyway-maven-plugin
to ignore a specific execution. The idea is to split the process into 2 executions: one that will be common to environments and another one specific to the test environment. When building with thedev
profile, the second execution will not be skipped whereas it will be skipped in the default case.