【发布时间】:2021-02-07 23:00:22
【问题描述】:
我在我的宠物项目中使用了 Java+Spring+Maven+Flyway+Postgres。 这里 db/migration 中有两个 sql 文件。 当我第一次运行应用程序时
mvn spring-boot:run
或在应用程序开始使用之前
mvn flyway:migrate -Dflyway.url=jdbc:postgresql://localhost:5432/university -Dflyway.user=tester -Dflyway.password=test
Db 是正确创建的,没有任何错误,但是当我想首先创建 V1 时
mvn flyway:baseline -Dflyway.url=jdbc:postgresql://localhost:5432/university -Dflyway.user=tester -Dflyway.password=test
然后:
mvn flyway:migrate -Dflyway.url=jdbc:postgresql://localhost:5432/university -Dflyway.user=tester -Dflyway.password=test
我发现错误:
[ERROR] Failed to execute goal org.flywaydb:flyway-maven-plugin:6.4.4:migrate (default-cli) on project universityschedule: org.flywaydb.core.internal.command.DbMigrate$FlywayMigrateException:
[ERROR] Migration V2__add_email_and_phone_to_person.sql failed
[ERROR] ------------------------------------------------------
[ERROR] SQL State : 42P01
[ERROR] Error Code : 0
[ERROR] Message : ERROR: relation "public.teacher" does not exist
为什么会这样?如何解决?
【问题讨论】:
标签: postgresql maven flyway