Redgate Summit – The Database DevOps Transformation Watch now
PASS Data Community Summit logo

PASS Data Community Summit

A hybrid conference in Seattle and online

15-18 November

Flyway Documentation

This documentation is deprecated. The new documentation can now be found on documentation.red-gate.com

Poll

Percona XtraDB Cluster

Supported Versions

Support Level

Compatible
Certified
Guaranteed Flyway Teams

Support Level determines the degree of support available for this database (learn more).

Drivers

URL format jdbc:mysql://host:port/database
Ships with Flyway Command-line Yes
Maven Central coordinates mysql:mysql-connector-java:8.0.12
Supported versions 8.0.12 and later
Default Java class com.mysql.jdbc.Driver

SQL Script Syntax

  • Standard SQL syntax with statement delimiter ;
  • Delimiter change for stored procedures using DELIMITER statements
  • Comment directives generated by mysqldump (/!…/;)
  • MySQL-style single-line comments (# Comment)

Compatibility

  • DDL exported by mysqldump can be used unchanged in a Flyway migration.
  • Any MySQL SQL script executed by Flyway, can be executed by the MySQL command-line tool and other MySQL-compatible tools (after the placeholders have been replaced).

Example

/* Single line comment */
CREATE TABLE test_data (
 value VARCHAR(25) NOT NULL,
 PRIMARY KEY(value)
);

/*
Multi-line
comment
*/

-- MySQL procedure
DELIMITER //
CREATE PROCEDURE AddData()
 BEGIN
   # MySQL-style single line comment
   INSERT INTO test_data (value) VALUES ('Hello');
 END //
DELIMITER;

CALL AddData();

-- MySQL comments directives generated by mysqlsump
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;

-- Placeholder
INSERT INTO ${tableName} (name) VALUES ('Mr. T');

Limitations

  • Issue 558 The parser currently doesn’t support multiple comment directives on a single line.
    Example: /!50003 CREATE/ /!50017 DEFINER=.../ /*!50003 TRIGGER EntityBeforeInsert …

TiDB