通过命令行进行的Flyway迁移不起作用

时间:2018-09-29 21:28:23

标签: mysql flyway

我无法获得在项目上运行迁移的途径。目录结构如下所示:

.
├── flyway.conf
└── sql
    └── V1__create_initial_tables.sql

运行flyway migrate返回:

Database: jdbc:mysql://localhost:3306/<db-name> (MySQL 5.7)

WARNING: You are connected to a MySQL database using the MariaDB driver. This is known to cause issues. An upgrade to Oracle's MySQL JDBC driver is highly recommended.

Successfully validated 0 migrations (execution time 00:00.006s)
Current version of schema `<db-name>`: << Empty Schema >>
Schema `<db-name>` is up to date. No migration necessary.

运行flyway info返回:

Schema version: << Empty Schema >>

+----------+---------+-------------+------+--------------+-------+
| Category | Version | Description | Type | Installed On | State |
+----------+---------+-------------+------+--------------+-------+
| No migrations found                                            |
+----------+---------+-------------+------+--------------+-------+

我做错了什么吗?

1 个答案:

答案 0 :(得分:3)

Flyway找不到任何迁移。默认情况下,它将在<install-dir>/sql中查找它们。

要覆盖迁移目录,您需要在flyway.locations文件中设置flyway.conf

flyway.locations=filesystem:/path/to/sql

或在命令行上指定它,例如:

flyway -locations=filesystem:/path/to/sql migrate