FlyWay: Why are schemas not created when setInitOnMigrate is set?

眉间皱痕 提交于 2019-12-12 02:00:46

问题


Scenario:

  • Existing database with one schema, the transport schema.
  • 2 migration files where version 1 is the initial / base version. Version 2 adds a table to the management schema (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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!