问题
Scenario:
- Existing database with one schema, the
transportschema. - 2 migration files where version 1 is the initial / base version. Version 2 adds a table to the
managementschema (but does not create that schema, I want FlyWay to do that).
Using FlyWay API (in Java application)
//...
flyway.setSchemas("transport", "management");
flyway.setInitVersion("1");
flyway.setInitOnMigrate(true);
flyway.migrate();
migration version 2 fails because the management schema has not being created. This succeeds as expected on a clean database.
I get the same problem when executing migrations via the maven plugin.
<configuration>
...
<schemas>
<schema>transport</schema>
<schema>management</schema>
</schemas>
</configuration>
...
mvn flyway:init -Dflyway.initVersion=1 -Dflyway.initDescription="Base version"
mvn flyway:migrate
Seems like if you are using FlyWay with an existing database, you then lose the ability to have FlyWay manage additional schemas.
回答1:
This is currently not supported. At this point it is an all or nothing deal. Please file a feature request in the issue tracker.
来源:https://stackoverflow.com/questions/25374196/flyway-why-are-schemas-not-created-when-setinitonmigrate-is-set