Search code examples
mysqlflyway

Flyway migration via command line not working


I haven't been able to get flyway to run migrations on my project. Directory structure looks like the following:

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

Running 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.

Running flyway info returns:

Schema version: << Empty Schema >>

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

Am I doing something incorrectly?


Solution

  • Flyway didn't find any migrations. By default, it will look for them in <install-dir>/sql.

    To override the migrations directory, you need to set flyway.locations in your flyway.conf file:

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

    or specify it on the command line, e.g.:

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