在新模式中添加第二个飞路实例

Adding 2nd flyway instance in new schema

我有一个现有的应用程序,其中包含一个现有的迁移脚本。它使用它所连接的数据库的 public 模式。

我正在开发第二个应用程序,出于数据库目的,它将访问 publicABC 架构,并具有对 public 和 [=32= 的读取访问权限] 访问 ABC。我希望第二个应用程序能够处理它自己的架构 ABC 的飞路迁移脚本。此应用程序的 flyway 实例可以完全忽略 public 模式。

当我 运行 应用程序时,我在日志中得到以下内容

2018-12-04 09:16:02.871  WARN 71133 --- [  restartedMain] o.f.c.i.s.JdbcTableSchemaHistory         : Could not find schema history table "public"."flyway_schema_history", but found "public"."schema_version" instead. You are seeing this message because Flyway changed its default for flyway.table in version 5.0.0 to flyway_schema_history and you are still relying on the old default (schema_version). Set flyway.table=schema_version in your configuration to fix this. This fallback mechanism will be removed in Flyway 6.0.0.
2018-12-04 09:16:02.904  INFO 71133 --- [  restartedMain] o.f.core.internal.command.DbValidate     : Successfully validated 49 migrations (execution time 00:00.028s)
2018-12-04 09:16:02.935  INFO 71133 --- [  restartedMain] o.f.core.internal.command.DbMigrate      : Current version of schema "public": 201808271553
2018-12-04 09:16:02.935  WARN 71133 --- [  restartedMain] o.f.core.internal.command.DbMigrate      : Schema "public" has version 201808271553, but no migration could be resolved in the configured locations !
2018-12-04 09:16:02.940  INFO 71133 --- [  restartedMain] o.f.core.internal.command.DbMigrate      : Schema "public" is up to date. No migration necessary.

这是我的application.yaml

flyway:
  url: jdbc:postgresql://localhost:5432/data
  schemas: ABC
  table: schema_version_module1
  user: flyway
  password: flyway

我希望 flyway 对所有内容都使用 mqa 架构(我手动创建的),而不是依赖 public 迁移历史架构。

这是一个 spring 引导 java 应用程序,在我的 build.gradle

中定义了 flyway-core:5.2.3

您的 Flyway 配置应该放在以 Spring Boot 2.0 开头的 Spring 命名空间下。参见 https://docs.spring.io/spring-boot/docs/current/reference/html/howto-database-initialization.html#howto-use-a-higher-level-database-migration-tool