春季啟動 2.4.5。
飛路 6.5.5。
我決定在我的本地機器上做一個實驗。
我洗掉了我的應用程式資料庫。
我所有的遷移都包括my用于創建表、序列等的架構。
例如:
create table if not exists my
(
name varchar not null
constraint category_pk primary key,
status varchar
);
我跑./gradlew api:flyWayMigrate。
my架構已連同其下的遷移表一起創建。但是架構下
沒有flyway_schema_history表。my
Publicschema 也已創建,但它只包含一個 table flyway_schema_history。
總結一下,my模式包含所有表,但不包含flyway_schema_history表。 public架構包含flyway_schema_history table,但不包含其他表。
啟動應用程式時,FlyWay 抱怨您在my架構中有表,但您沒有flyway_schema_history表,請使用基線屬性。
基線屬性不是我所期望的。我需要一個單一的模式 -my在flyway_schema_history其中。
所以我已經將這些行添加到application.properties檔案中。
spring.flyway.schemas=my
spring.flyway.default-schema=my
但這沒有幫助。只有通過添加schemas = ['my']FlyWaybuild.gradle部分,當my
架構下所有需要的表連同flyway_schema_history表一起時,我已經達到了結果。
flyway {
url = 'jdbc:postgresql://localhost:5432/postgres'
user = 'postgres'
password = 'password'
locations = ['classpath:sql']
schemas = ['my']
}
所以我的問題是為什么spring.flyway.schemas和spring.flyway.default-schema屬性application.properties不起作用?
uj5u.com熱心網友回復:
我猜是因為您使用的 jpa hibernate 也可以進行遷移
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/503840.html
