在新架构中添加第二个飞行通道实例



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

我正在开发第二个应用程序,为了数据库的目的,它将访问publicABC模式,具有对public的读取访问权限和对ABC的读取/写入访问权限。我希望第二个应用程序能够为模式ABC处理自己的flyway迁移脚本。这个应用程序的flyway实例可以完全忽略公共模式。

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

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模式(我手动创建的(,而不是依赖公共模式来获取迁移历史。

这是一个spring-boot java应用程序,在我的build.gradle 中定义了flyway-core:5.2.3

从Spring Boot 2.0开始,您的Flyway配置应该放在Spring命名空间下。看见https://docs.spring.io/spring-boot/docs/current/reference/html/howto-database-initialization.html#howto-使用高级数据库迁移工具

最新更新