I have created two different instances of Flyway in 2 different projects in my eclipse workspace.
They are pointing to different data sources/2 diff databases and also have separate src.main.resources.db.migration packages. Each package contains different sql files for the respective databases.
When I start my application, Flyway is identifying scripts from one project only (project initialized first) and executing the scripts from this project to the other DB also.
Is it possible for Flyway to update 2 databases simultaneously?
Thanks for the reply. But could you please explain how this can be implemented in Java Code. For eg: Curretnly I am using the following way...
Flyway flyway = new Flyway();
InitialContext ictx = new InitialContext();
DataSource dataSource = (DataSource) ictx.lookup("DS-name");
flyway.setDataSource(dataSource);
flyway.setLocations("main.resources.db.migration");//location under first project
flyway.migrate();
Flyway flywaygen = new Flyway;
InitialContext ictx = new InitialContext();
DataSource dataSource = (DataSource) ictx.lookup("DS-name");
flywaygen.setDataSource(dataSource);
flywaygen.setLocations("main.resources.emlogis.migration");//location under second project
flywaygen.migrate();
The issue is that flywaygen is also looking at the first project location. So if in the first location 3 sql scripts are added and 2 scripts in the second one, the second flyway instance says Migration 3 completed. So flywaygen is also pointing at main.resources.db.migration instead of main.resources.emlogis.migration.