FlyWay:设置setInitOnMigrate时为什么不创建架构? [英] FlyWay: Why are schemas not created when setInitOnMigrate is set?

查看:126
本文介绍了FlyWay:设置setInitOnMigrate时为什么不创建架构?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

场景:

  • 具有一个模式transport模式的现有数据库.
  • 2个迁移文件,其中版本1是初始/基本版本.版本2将表添加到management架构(但不创建该架构,我希望FlyWay做到这一点).
  • 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).

使用FlyWay API(在Java应用程序中)

Using FlyWay API (in Java application)

//...
flyway.setSchemas("transport", "management");
flyway.setInitVersion("1");
flyway.setInitOnMigrate(true);
flyway.migrate();

迁移版本2失败,因为尚未创建management模式.在干净的数据库上,此操作成功完成.

migration version 2 fails because the management schema has not being created. This succeeds as expected on a clean database.

通过maven插件执行迁移时遇到相同的问题.

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

好像您将FlyWay与现有数据库一起使用时,您将失去让FlyWay管理其他架构的功能.

Seems like if you are using FlyWay with an existing database, you then lose the ability to have FlyWay manage additional schemas.

推荐答案

当前不支持此功能.在这一点上,这是一个全有或全无的交易.请在问题跟踪器中提出功能请求.

This is currently not supported. At this point it is an all or nothing deal. Please file a feature request in the issue tracker.

这篇关于FlyWay:设置setInitOnMigrate时为什么不创建架构?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆