添加新的遷移文件后,我試圖flywayMigrate從我的項目中的 Gradle 運行任務,但 Flyway 沒有接收到它。我得到這個輸出:Flyway Community Edition 5.2.4 by BoxfuseDatabase: jdbc:postgresql://localhost:5432/mydb (PostgreSQL 10.6)Successfully validated 6 migrations (execution time 00:00.105s)Current version of schema "public": 5Schema "public" is up to date. No migration necessary.所以它檢測到我有6 個遷移但它不執行我剛添加的新文件 ( V6) 并堅持說模式是最新的,即使它不是。這是我的配置的樣子:{ url = database_url user = database_user password = database_password driver = database_driver schemas = ["public"] locations = ["filesystem:shared/src/main/resources/db/migration"] table = "flyway_schema_history" sqlMigrationPrefix = "V" sqlMigrationSuffix = ".sql" placeholderPrefix = "\${" placeholderSuffix = "}" target = "5.1"}我檢查了每個設置,沒問題,如果我刪除所有表,它會選擇前5 個遷移文件,但由于某種原因,第6個文件沒有被選擇。(我什至嘗試添加第 7 個,但它也不起作用)我嘗試sql在第 6 個遷移文件中運行它,它運行正常,因此 Flyway 可能存在問題。如果我使用debug標志運行,我可以看到它甚至解析并從文件中讀出 sql,但所有遷移都被過濾掉了。我究竟做錯了什么?
1 回答

眼眸繁星
TA貢獻1873條經驗 獲得超9個贊
你有target = "5.1"你的配置,但是
target NO latest version
The target version up to which Flyway should run migrations.
Migrations with a higher version number will not be applied.
The string 'current' will be interpreted as MigrationVersion.CURRENT,
a placeholder for the latest version that has been applied to the database.
查看Gradle 任務:flywayMigrate
這就是為什么你不能處理遷移 > 5.1
添加回答
舉報
0/150
提交
取消