【问题标题】:Flyway migration via command line not working通过命令行进行的 Flyway 迁移不起作用
【发布时间】:2019-03-05 11:26:23
【问题描述】:

我无法在我的项目上运行迁移。目录结构如下:

.
├── 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                                            |
+----------+---------+-------------+------+--------------+-------+

我是不是做错了什么?

【问题讨论】:

    标签: mysql flyway


    【解决方案1】:

    Flyway 没有找到任何迁移。默认情况下,它将在&lt;install-dir&gt;/sql 中查找它们。

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

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

    或在命令行中指定,例如:

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

    【讨论】:

      猜你喜欢
      • 2013-07-08
      • 2016-09-24
      • 2017-05-31
      • 2020-07-03
      • 2023-03-13
      • 2013-08-14
      • 2015-08-18
      • 2016-09-05
      • 2020-08-16
      相关资源
      最近更新 更多