I also had the same problem. I wanted to start migration of flight routes for different databases and even for the same database with different configurations in the ONE gradle build. for each database I need to migrate regular data tables and static data tables, so I use two span version tables, as well as two scripting locations. For instance.
ENV: dev MIGRATION1: data (locations: db/scripts/data table: _flyway_version_data) MIGRATION2: static (locations: db/scripts/static table: _flyway_version_static) ENV: test MIGRATION1 .... MIGRATION2 ....
According to Peter, the flight tasks are only performed no matter how often you name them.
The workaround I found doesn't seem to be the most enjoyable, but it works:
in build.gradle
task migrateFlywayDevData(type: GradleBuild) { buildFile = 'build.gradle' tasks = ['flywayMigrate'] startParameter.projectProperties = [env: "dev", type="data"] } task migrateFlywayDevStatic(type: GradleBuild) { buildFile = 'build.gradle' tasks = ['flywayMigrate'] startParameter.projectProperties = [env: "test", type="static"] } ....(task defs for test env)
Basically, I create a new gradle construct for each of the configurations.
"buildFile = 'build.gradle'"
refers to itself, so all code is contained in a single build.gradle file. Then call gradle:
gradle migrateFlywayDevData migrateFlywayDevStatic ...
This is the first version. therefore, the code can be easily improved. However, this solution allows you to perform multiple route tasks with a single gradle call.
Do not forget to comment (plugin configuration is not shown here)
source share