The agile database migration framework for Java

Get Started with Flyway 2.3

Flyway

Migrate directly from within your application

Flyway flyway = new Flyway();
flyway.setDataSource(url, user, password);
flyway.migrate();
Get Started with the Java API

For non-JVM users and environments without Maven or Ant

> flyway migrate -url=... -user=... -password=...
Get Started with the Command-line Tool

Seamless integration with Maven 2/3 builds

> mvn flyway:migrate -Dflyway.url=... -Dflyway.user=... -Dflyway.password=...
Get Started with the Maven Plugin

Seamless integration with Gradle builds

> gradle flywayMigrate -Dflyway.url=... -Dflyway.user=... -Dflyway.password=...
Get Started with the Gradle Plugin

Antlib with tasks for Ant 1.8 and above

<flyway:migrate url="..." user="..." password="..."/>
Get Started with the Ant Tasks

First class SBT integration

> sbt flywayMigrate -Dflyway.url=... -Dflyway.user=... -Dflyway.password=...
Get Started with the SBT plugin

It just works. Refreshingly simple.
Migrate from any version (incl. an empty database) to the latest version of the schema
Plain Old Sql

Plain SQL scripts (incl. placeholder replacement). No proprietary XML formats, no lock-in.

No limits

Java-based migrations for advanced data transformations and handling with LOBs

Zero required dependencies

All you need is Java 5+ and your Jdbc driver and you're good to go!

Convention Over Configuration

Classpath Scanning to automatically discover Sql and Java migrations

Highly reliable

Safe for cluster environments (Multiple machines can migrate in parallel)

Cloud support

Full support for Microsoft SQL Azure, Google Cloud SQL & App Engine, Heroku Postgres and Amazon RDS.

Auto-migration on startup

Ship migrations together with the application and run them automatically on startup using the API

Fail fast

Inconsistent database or failed migration prevents app from starting.

Schema Clean

Drop all tables, views, triggers, ... from a schema without dropping the schema itself


Your relational database. Supported.
Choose from the wide range of supported databases

10g and later (all editions, including XE)

2008 and later

latest

9.7 and later

5.1 and later

9.0 and later

1.2.137 and later

1.8 and later

10.8.2.2 and later


Feature Comparison
Pick the right tool for the job.
Flyway Liquibase c5-db-migration dbdeploy mybatis MIGRATEdb migrate4j dbmaintain AutoPatch

Migration types

Plain Old Sql migrations 1
Java migrations 1
Groovy migrations
Xml migrations
DDL abstraction DSL

Execution

API
Command-line
Maven
Gradle 2 2 2
Ant
SBT 2 2

Databases

Oracle
SQL Server
DB2
MySQL
PostgreSQL
H2
Hsql
Derby

Sql Parser

Oracle PL/SQL 3
SQL Server T-SQL 3
DB2 SQL PL 3
MySQL stored procedures 3 4
PostgreSQL stored procedures 3

Other

Auto creation of schema
Auto creation of metadata table
Cluster-safe
Checksum validation
Placeholder replacement
Multiple schema support
Clean existing schema
Output to SQL file
Available on Maven Central
License Apache v2 Apache v2 Apache v2 LGPL Apache v2 BSD LGPL v3 Apache v2 Apache

1. Sql files and Java classes can be used indirectly through references in xml migrations
2. Not out of the box. Available through a 3rd party. May be outdated.
3. Only a single statement at a time is supported. No mixed delimiters.
4. Only Oracle-style PL/SQL delimeters. No MySQL standard syntax using the DELIMITER statement.

Ready to get started?
Pick any of these to learn more.

Why database migrations? How does Flyway work? First steps Download