Flyway 仅迁移我的两个配置模式之一

Flyway only migrates one of my two configured schemas

我有一个 MySQL 5.7 实例,它需要两个具有相同架构的数据库。我正在尝试将 flyway 与多个模式一起使用来完成此操作。我正在使用 MySQL 连接器的 Maven 插件和 v5.1.38。这是我的 POM 配置:

                <plugin>
                    <groupId>org.flywaydb</groupId>
                    <artifactId>flyway-maven-plugin</artifactId>
                    <version>4.0</version>
                    <configuration>
                        <url>jdbc:mysql://192.168.99.100:3306</url>
                        <user>root</user>
                        <password>mypassword</password>
                        <schemas>
                            <schema>stage</schema>
                            <schema>public</schema>
                        </schemas>
                    </configuration>
                </plugin>

运行 来自空数据库,这是输出:

[INFO] Database: jdbc:mysql://192.168.99.100:3306 (MySQL 5.7)
[INFO] Successfully validated 3 migrations (execution time 00:00.013s)
[INFO] Creating schema `stage` ...
[INFO] Creating schema `public` ...
[INFO] Creating Metadata table: `stage`.`schema_version`
[INFO] Current version of schema `stage`: 0
[INFO] Migrating schema `stage` to version 1 - initialize schema
[INFO] Migrating schema `stage` to version 2 - seed users
[INFO] Migrating schema `stage` to version 3 - create read items proc
[WARNING] DB: PROCEDURE stage.read_items does not exist (SQL State: 42000 - Error Code: 1305)
[INFO] Successfully applied 3 migrations to schema `stage` (execution time 00:01.824s).

它创建了两个模式,但随后只运行第一个模式的迁移。是我做错了什么,还是 Flyway 中的错误?

更新:

我尝试使用此配置为 Maven 插件创建两个执行:

                <plugin>
                    <groupId>org.flywaydb</groupId>
                    <artifactId>flyway-maven-plugin</artifactId>
                    <version>4.0.1</version>
                    <executions>
                        <execution>
                            <id>migrate-stage</id>
                            <goals>
                                <goal>migrate</goal>
                            </goals>
                            <configuration>
                                <url>jdbc:mysql://192.168.99.100:3306/stage</url>
                                <user>root</user>
                                <password>password</password>
                                <schemas>
                                    <schema>stage</schema>
                                </schemas>
                            </configuration>
                        </execution>
                        <execution>
                            <id>migrate-pub</id>
                            <goals>
                                <goal>migrate</goal>
                            </goals>
                            <configuration>
                                <url>jdbc:mysql://192.168.99.100:3306/public</url>
                                <user>root</user>
                                <password>password</password>
                                <schemas>
                                    <schema>public</schema>
                                </schemas>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>

这给了我以下错误:

Unable to connect to the database. Configure the url, user and password!

这似乎类似于以下内容:Flyway database migration to multiple schemas
正如 Fontaine 先生所建议的那样,您应该针对这种情况拆分架构。
我不确定 schema-tag 的正确用法,因为我自己是 Flyway 的新手。
希望这对您有所帮助!

这不是我希望得到的答案,但在尝试了所有其他方法后,我最终只是复制了第二个模式的 SQL,并在之前添加了 use public;use stage;相应的部分。