更改迁移脚本位置后,flyway迁移失败

时间:2019-05-20 05:13:51

标签: java database flyway

我正在使用flyway-core 4.0.1,更改了迁移脚本的位置之后,我开始收到FlywayException:

Found non-empty schema(s) \"USR_BXW0L32J7GU3ZB5I9\" without metadata table! Use baseline() or set baselineOnMigrate to true to initialize the metadata table.

做完一些研究后,有人说校验和可能会更改,需要重新计算。 -为此,我使用了flyway.repair(),但还是没有运气。

flyway.validateOnMigrate设置为true,如果我将其设置为false flyway不会抛出任何异常,并且在当前一个flyway_schema_history旁边创建了一个新的schema_version表。

更新

将baselineOnMigrate设置为true后,我得到以下信息:

似乎它试图运行已执行的现有迁移脚本。

SAP DBTech JDBC: [288] (at 18): cannot use duplicate table name: CDM_ENTITIES: line 1 col 19 (at pos 18)\nLocation   : db/migration/hana/V18.8.16.0__entities_collection.sql (/home/vcap/app/BOOT-INF/classes/db/migration/hana/V18.8.16.0__entities_collection.sql)\nLine       : 1\nStatement  : CREATE TABLE ENTITIES\n","\tat org.flywaydb.core.internal.dbsupport.SqlScript.execute(SqlScript.java:145)","\tat org.flywaydb.core.internal.resolver.sql.SqlMigrationExecutor.execute(SqlMigrationExecutor.java:76)","\tat org.flywaydb.core.internal.command.DbMigrate.doMigrate(DbMigrate.java:324)","\tat org.flywaydb.core.internal.command.DbMigrate.access$900(DbMigrate.java:49)","\tat org.flywaydb.core.internal.command.DbMigrate$4.call(DbMigrate.java:280)","\tat org.flywaydb.core.internal.util.jdbc.TransactionTemplate.execute(TransactionTemplate.java:75)","\tat org.flywaydb.core.internal.command.DbMigrate.applyMigration(DbMigrate.java:277)","\tat org.flywaydb.core.internal.command.DbMigrate.access$800(DbMigrate.java:49)","\tat org.flywaydb.core.internal.command.DbMigrate$2.call(DbMigrate.java:201)","\tat org.flywaydb.core.internal.command.DbMigrate$2.call(DbMigrate.java:142)","\tat org.flywaydb.core.internal.dbsupport.DbSupport$1.call(DbSupport.java:224)","\tat org.flywaydb.core.internal.util.jdbc.TransactionTemplate.execute(TransactionTemplate.java:75)","\tat org.flywaydb.core.internal.dbsupport.DbSupport.lock(DbSupport.java:220)","\tat org.flywaydb.core.internal.metadatatable.MetaDataTableImpl.lock(MetaDataTableImpl.java:174)","\tat org.flywaydb.core.internal.command.DbMigrate.migrate(DbMigrate.java:142)","\tat org.flywaydb.core.Flyway$1.execute(Flyway.java:969)","\tat org.flywaydb.core.Flyway$1.execute(Flyway.java:930)","\tat org.flywaydb.core.Flyway.execute(Flyway.java:1413)","\tat org.flywaydb.core.Flyway.migrate(Flyway.java:930)","\tat com.sap.portal.cf.database.config.DataSourceConfig.flyway(DataSourceConfig.java:94)","\tat com.sap.portal.cf.database.config.DataSourceConfig$$EnhancerBySpringCGLIB$$146f6288.CGLIB$flyway$8(<generated>)","\tat

0 个答案:

没有答案