我有一个现有的应用程序,带有一个现有的flyway迁移脚本。它使用所连接数据库的public
模式。
我正在开发第二个应用程序,出于数据库目的,该应用程序将访问public
和ABC
模式,并具有对public
的读取访问权限和对{ {1}}。我希望第二个应用处理其自己的模式ABC
的flyway迁移脚本。这个应用程序的flyway实例可以完全忽略公共架构。
运行该应用程序时,我会在日志中看到以下内容
ABC
这是我的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将mqa模式(我手动创建)用于所有内容,而不是依赖公共模式来进行迁移历史记录。
这是一个Spring Boot Java应用程序,在我的build.gradle中定义了flyway:
url: jdbc:postgresql://localhost:5432/data
schemas: ABC
table: schema_version_module1
user: flyway
password: flyway
答案 0 :(得分:1)
您的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