Flyway可以从jar中迁移吗?

BAE*_*BAE 5 java postgresql database-migration flyway

我有一个内置到 jar 文件中的子项目。src/main/resources/db/migration/V1_1__create_table.sql项目里有。

如何从这个 jar 运行迁移?

我尝试了这个./flyway migrate -url=jdbc:postgresql://127.0.0.1:5432/myproject -user=myproject -password=myproject -locations=classpath:~/src/myproject/target/myproject-0.0.1-SNAPSHOT.jar,但出现以下错误:

Database: jdbc:postgresql://127.0.0.1:5432/myproject (PostgreSQL 9.6) WARNING: Unable to resolve location classpath:~/src/myproject/target/myprojectn-0/0/1-SNAPSHOT/jar WARNING: Schema "public" has version 0.0.6, but no migration could be resolved in the configured locations !

如何从 jar 运行迁移?谢谢。

Axe*_*ine 2

您必须将 jar 放在<flyway-install>/jars目录中并使用-locations=classpath:db/migration.

请参阅https://flywaydb.org/documentation/commandline/#installation