从4.X升级到5.x的flyway再次运行已运行的迁移脚本

时间:2019-03-11 20:16:28

标签: spring-boot flyway

我正在从1.5升级springboot 2。为此,我将飞行路线从4.X升级到5.24。之后,当我运行springboot应用程序时,它正在执行已经执行过的脚本。以下是我看到的日志。删除项目的特定名称,因为我不允许发布该名称:

myproject     INFO 2019-03-11T16:08:11-0400 main [org.flywaydb.core.internal.schemahistory.JdbcTableSchemaHistory] Creating Schema History table: "PUBLIC"."flyway_schema_history"
myproject     INFO 2019-03-11T16:08:11-0400 main [org.flywaydb.core.internal.command.DbMigrate] Current version of schema "PUBLIC": << Empty Schema >>
myproject     INFO 2019-03-11T16:08:11-0400 main [org.flywaydb.core.internal.command.DbMigrate] Migrating schema "PUBLIC" to version 1 - CREATE mything
myproject     ERROR 2019-03-11T16:08:11-0400 main [org.flywaydb.core.internal.command.DbMigrate] Migration of schema "PUBLIC" to version 1 - CREATE mything failed! Please restore backups and roll back database and code!
myproject     WARN 2019-03-11T16:08:11-0400 main [org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext] Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flywayInitializer' defined in class path resource [org/springframework/boot/autoconfigure/flyway/FlywayAutoConfiguration$FlywayConfiguration.class]: Invocation of init method failed; nested exception is org.flywaydb.core.internal.command.DbMigrate$FlywayMigrateException: 
Migration V1__CREATE_mything.sql failed
---------------------------------------
SQL State  : 42509
Error Code : -5509
Message    : type not found or user lacks privilege: SERIAL

1 个答案:

答案 0 :(得分:1)

我想您正在使用参数table.name的默认值,该参数在5.0.0版中已更改。

请参阅https://flywaydb.org/documentation/releaseNotes

Issue 1848 flyway.table的默认值已从schema_version更改为flyway_schema_history