我无法获得在项目上运行迁移的途径。目录结构如下所示:
.
├── 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 |
+----------+---------+-------------+------+--------------+-------+
我做错了什么吗?
答案 0 :(得分:3)
Flyway找不到任何迁移。默认情况下,它将在<install-dir>/sql
中查找它们。
要覆盖迁移目录,您需要在flyway.locations
文件中设置flyway.conf
:
flyway.locations=filesystem:/path/to/sql
或在命令行上指定它,例如:
flyway -locations=filesystem:/path/to/sql migrate