or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

connection-management.mddatabase-operations.mddatabase-types.mdindex.mdschema-management.mdsql-parsing.mdutility-components.md
tile.json

tessl/maven-org-flywaydb--flyway-mysql

MySQL database type plugin for Flyway database migration engine providing specialized MySQL and MariaDB support for schema migrations.

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
mavenpkg:maven/org.flywaydb/flyway-mysql@11.8.x

To install, run

npx @tessl/cli install tessl/maven-org-flywaydb--flyway-mysql@11.8.0

index.mddocs/

Flyway MySQL

Flyway MySQL is a database type plugin that provides MySQL and MariaDB support for the Flyway database migration engine. It implements database-specific functionality including SQL parsing, connection handling, schema operations, and transaction management tailored for MySQL environments.

Package Information

  • Package Name: flyway-mysql
  • Package Type: Maven JAR
  • Language: Java
  • Group ID: org.flywaydb
  • Artifact ID: flyway-mysql
  • Version: 11.8.2
  • Installation: Add dependency to Maven pom.xml or Gradle build.gradle

Maven:

<dependency>
    <groupId>org.flywaydb</groupId>
    <artifactId>flyway-mysql</artifactId>
    <version>11.8.2</version>
</dependency>

Gradle:

implementation 'org.flywaydb:flyway-mysql:11.8.2'

Core Imports

The plugin is automatically discovered through Java's Service Provider Interface (SPI). No direct imports are needed for basic usage as Flyway automatically loads the plugins.

For direct access to specific classes:

import org.flywaydb.database.mysql.MySQLDatabaseType;
import org.flywaydb.database.mysql.mariadb.MariaDBDatabaseType;
import org.flywaydb.database.mysql.MySQLDatabase;
import org.flywaydb.database.mysql.MySQLConnection;
import org.flywaydb.database.mysql.MySQLParser;
import org.flywaydb.database.mysql.MySQLSchema;
import org.flywaydb.database.mysql.MySQLTable;
import org.flywaydb.database.mysql.MySQLNamedLockTemplate;
import org.flywaydb.authentication.mysql.MySQLOptionFileReader;

Basic Usage

The plugin is used automatically by Flyway when connecting to MySQL or MariaDB databases. Simply configure Flyway with MySQL connection details:

import org.flywaydb.core.Flyway;

// Configure Flyway - the MySQL plugin is auto-discovered
Flyway flyway = Flyway.configure()
    .dataSource("jdbc:mysql://localhost:3306/mydb", "user", "password")
    .load();

// Run migrations - MySQL plugin handles database-specific operations
flyway.migrate();

Supported JDBC URLs:

  • jdbc:mysql://... - Standard MySQL
  • jdbc:mariadb://... - MariaDB
  • jdbc:google://... - Google Cloud SQL
  • jdbc:p6spy:mysql://... - P6Spy proxy URLs
  • AWS wrapper URLs with MySQL

Architecture

The flyway-mysql plugin is built around Flyway's extensible database type system:

  • Database Type Plugins: MySQLDatabaseType and MariaDBDatabaseType register as Flyway plugins via SPI
  • Database Instances: MySQLDatabase and MariaDBDatabase provide database-specific behavior
  • Connection Management: MySQLConnection handles MySQL-specific connection state and operations
  • SQL Parsing: MySQLParser and MariaDBParser handle MySQL/MariaDB-specific SQL syntax
  • Schema Operations: MySQLSchema and MySQLTable manage database schema objects
  • Authentication: MySQLOptionFileReader supports MySQL option file authentication

Capabilities

Database Type Registration

Primary entry points for MySQL and MariaDB database support, automatically discovered by Flyway's plugin system.

public class MySQLDatabaseType extends BaseDatabaseType {
    public String getName();
    public List<String> getSupportedEngines();
    public boolean handlesJDBCUrl(String url);
    public String getDriverClass(String url, ClassLoader classLoader);
    public Database createDatabase(Configuration configuration, JdbcConnectionFactory jdbcConnectionFactory, StatementInterceptor statementInterceptor);
    public Parser createParser(Configuration configuration, ResourceProvider resourceProvider, ParsingContext parsingContext);
}

public class MariaDBDatabaseType extends BaseDatabaseType {
    public String getName();
    public int getPriority();
    public boolean handlesJDBCUrl(String url);
    public String getDriverClass(String url, ClassLoader classLoader);
    public Database createDatabase(Configuration configuration, JdbcConnectionFactory jdbcConnectionFactory, StatementInterceptor statementInterceptor);
    public Parser createParser(Configuration configuration, ResourceProvider resourceProvider, ParsingContext parsingContext);
}

Database Types

Database Operations

MySQL-specific database implementations providing connection management, version detection, and specialized behavior for MySQL environments.

public class MySQLDatabase extends Database<MySQLConnection> {
    public MySQLDatabase(Configuration configuration, JdbcConnectionFactory jdbcConnectionFactory, StatementInterceptor statementInterceptor);
    public boolean isWsrepOn();
    public static MigrationVersion extractMySQLVersionFromString(String selectVersionOutput);
    public static MigrationVersion extractMariaDBVersionFromString(String selectVersionOutput);
    public static boolean isRunningInPerconaXtraDBClusterWithStrictMode(JdbcTemplate jdbcTemplate);
    public static boolean isWsrepOn(JdbcTemplate jdbcTemplate);
    public static boolean isRunningInGTIDConsistencyMode(JdbcTemplate jdbcTemplate);
}

public class MariaDBDatabase extends MySQLDatabase {
    public MariaDBDatabase(Configuration configuration, JdbcConnectionFactory jdbcConnectionFactory, StatementInterceptor statementInterceptor);
}

Database Operations

Connection Management

MySQL-specific connection handling with state restoration, AWS RDS detection, and variable management.

public class MySQLConnection extends Connection<MySQLDatabase> {
    public MySQLConnection(MySQLDatabase database, java.sql.Connection connection);
    public boolean isAwsRds();
}

Connection Management

SQL Parsing

MySQL and MariaDB-specific SQL parsers handling database-specific syntax, delimiters, and statement types.

public class MySQLParser extends Parser {
    public MySQLParser(Configuration configuration, ParsingContext parsingContext);
}

public class MariaDBParser extends MySQLParser {
    public MariaDBParser(Configuration configuration, ParsingContext parsingContext);
}

SQL Parsing

Schema Management

MySQL-specific implementations for schema and table operations with database-specific behavior.

class MySQLSchema extends Schema<MySQLDatabase, MySQLTable> {
    MySQLSchema(JdbcTemplate jdbcTemplate, MySQLDatabase database, String name);
    public Table getTable(String tableName);
}

class MySQLTable extends Table<MySQLDatabase, MySQLSchema> {
    MySQLTable(JdbcTemplate jdbcTemplate, MySQLDatabase database, MySQLSchema schema, String name);
}

Schema Management

Utility Components

Additional utility classes for named locks and authentication support.

public class MySQLNamedLockTemplate {
    MySQLNamedLockTemplate(JdbcTemplate jdbcTemplate, int discriminator);
    public <T> T execute(Callable<T> callable);
}

public class MySQLOptionFileReader implements ExternalAuthFileReader {
    public MySQLOptionFileReader();
    public List<String> getAllContents();
    public void populateOptionFiles();
}

Utility Components

Types

Core Types

// Database configuration and connection types
public interface Configuration {
    // Flyway configuration interface
}

public interface JdbcConnectionFactory {
    // JDBC connection factory interface
}

public interface StatementInterceptor {
    // Statement interception interface
}

// Migration and version types
public class MigrationVersion {
    public static MigrationVersion fromVersion(String version);
    public boolean isAtLeast(String targetVersion);
}

// Template and execution types
public interface Callable<T> {
    T call() throws Exception;
}

Exception Types

public class FlywayException extends RuntimeException {
    // General Flyway exceptions
}

public class FlywaySqlException extends FlywayException {
    // SQL-related exceptions
}

public class FlywayEditionUpgradeRequiredException extends FlywayException {
    // Premium feature exceptions
}

Authentication Types

public interface ExternalAuthFileReader {
    List<String> getAllContents();
}