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

Flyway migration via command line not working

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

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

运行 flyway migrate returns:

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 returns:

Schema version: << Empty Schema >>

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

我做错了什么吗?

Flyway 没有发现任何迁移。默认情况下,它将在 <install-dir>/sql.

中查找它们

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

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

或在命令行指定,例如:

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