Convert Figma logo to code with AI

flyway logoflyway

Flyway by Redgate • Database Migrations Made Easy.

8,625
1,533
8,625
188

Top Related Projects

Main Liquibase Source

16,274

Database migrations. CLI and Golang library.

5,808

🚀 A lightweight, framework-agnostic database migration tool.

SQL schema migration tool for Go.

Quick Overview

Flyway is a popular open-source database migration tool that helps manage and version control database schema changes. It supports a wide range of databases and can be integrated into various build and deployment processes, making it easier to evolve database schemas alongside application code.

Pros

  • Simple and intuitive versioning system for database migrations
  • Supports multiple database types (e.g., MySQL, PostgreSQL, Oracle, SQL Server)
  • Can be used via command-line, Java API, or build tool plugins (Maven, Gradle)
  • Provides both forward and backward compatibility for migrations

Cons

  • Limited support for complex database refactoring scenarios
  • Can be challenging to manage in large teams with concurrent development
  • Requires careful management of migration scripts to avoid conflicts
  • May have performance issues with very large databases or numerous migrations

Code Examples

  1. Basic SQL migration script:
-- V1__Create_person_table.sql
CREATE TABLE person (
    id INT NOT NULL PRIMARY KEY,
    name VARCHAR(100) NOT NULL
);
  1. Java-based migration:
public class V2__Add_email_to_person implements JavaMigration {
    public void migrate(Context context) throws Exception {
        try (Statement stmt = context.getConnection().createStatement()) {
            stmt.execute("ALTER TABLE person ADD COLUMN email VARCHAR(100)");
        }
    }
}
  1. Flyway Java API usage:
Flyway flyway = Flyway.configure()
    .dataSource("jdbc:h2:mem:testdb", "sa", null)
    .load();
flyway.migrate();

Getting Started

To get started with Flyway:

  1. Add Flyway to your project (e.g., Maven dependency):

    <dependency>
        <groupId>org.flywaydb</groupId>
        <artifactId>flyway-core</artifactId>
        <version>8.5.13</version>
    </dependency>
    
  2. Create migration scripts in src/main/resources/db/migration:

    • Name format: V<version>__<description>.sql
    • Example: V1__Create_person_table.sql
  3. Configure Flyway in your application:

    Flyway flyway = Flyway.configure()
        .dataSource("jdbc:mysql://localhost:3306/mydb", "user", "password")
        .load();
    flyway.migrate();
    
  4. Run your application, and Flyway will automatically apply the migrations.

Competitor Comparisons

Main Liquibase Source

Pros of Liquibase

  • More flexible change format options (XML, YAML, JSON, SQL)
  • Better support for complex database refactoring
  • Stronger rollback capabilities

Cons of Liquibase

  • Steeper learning curve due to more complex configuration
  • Slower execution compared to Flyway for large change sets

Code Comparison

Flyway migration:

CREATE TABLE users (
  id INT PRIMARY KEY,
  name VARCHAR(100) NOT NULL
);

Liquibase changeset (XML format):

<changeSet id="1" author="dev">
  <createTable tableName="users">
    <column name="id" type="int">
      <constraints primaryKey="true"/>
    </column>
    <column name="name" type="varchar(100)">
      <constraints nullable="false"/>
    </column>
  </createTable>
</changeSet>

Both Flyway and Liquibase are popular database migration tools, each with its own strengths. Flyway is known for its simplicity and ease of use, making it a good choice for smaller projects or teams new to database migration tools. Liquibase offers more advanced features and flexibility, making it suitable for complex database schemas and larger teams with specific requirements. The choice between the two often depends on project complexity, team expertise, and specific database management needs.

16,274

Database migrations. CLI and Golang library.

Pros of migrate

  • Written in Go, offering better performance and easier deployment in containerized environments
  • Supports a wider range of databases, including NoSQL options like MongoDB and Cassandra
  • Provides a CLI tool and a Go library, allowing for more flexible integration options

Cons of migrate

  • Less mature and less widely adopted compared to Flyway
  • Documentation is not as comprehensive or well-organized
  • Lacks some advanced features like undo migrations and callbacks

Code Comparison

Flyway (Java):

@Component
public class V1__Create_person_table implements JavaMigration {
    public void migrate(Context context) throws Exception {
        context.getConnection().createStatement().execute(
            "CREATE TABLE person (" +
            "    id INT NOT NULL PRIMARY KEY," +
            "    name VARCHAR(100) NOT NULL" +
            ")");
    }
}

migrate (Go):

package main

import (
    "database/sql"
    "github.com/golang-migrate/migrate/v4"
)

func main() {
    m, _ := migrate.New("file://migrations", "postgres://localhost:5432/database")
    m.Up()
}

Both tools offer database migration capabilities, but they cater to different ecosystems and use cases. Flyway is more established and feature-rich, while migrate provides better performance and flexibility for Go-based projects and diverse database support.

5,808

🚀 A lightweight, framework-agnostic database migration tool.

Pros of dbmate

  • Simpler setup and usage, with a single binary executable
  • Database-agnostic, supporting multiple database types out of the box
  • Built-in schema dump functionality for easier version control

Cons of dbmate

  • Less mature and less widely adopted compared to Flyway
  • Fewer advanced features and customization options
  • Limited integration with build tools and frameworks

Code Comparison

Flyway migration:

CREATE TABLE users (
  id INT PRIMARY KEY,
  name VARCHAR(255),
  email VARCHAR(255)
);

dbmate migration:

-- migrate:up
CREATE TABLE users (
  id INT PRIMARY KEY,
  name VARCHAR(255),
  email VARCHAR(255)
);

-- migrate:down
DROP TABLE users;

Both tools use SQL for migrations, but dbmate includes up and down migrations in a single file, while Flyway typically uses separate files for each direction.

Flyway offers more complex migration types (Java-based migrations, for example), while dbmate focuses on simplicity with SQL-only migrations.

dbmate's approach may be more straightforward for simple projects, while Flyway's extensive features and integrations make it suitable for larger, more complex applications.

SQL schema migration tool for Go.

Pros of sql-migrate

  • Written in Go, offering better performance and easier deployment for Go-based projects
  • Supports both up and down migrations, allowing for easier rollbacks
  • Provides a simple CLI interface for managing migrations

Cons of sql-migrate

  • Less extensive database support compared to Flyway
  • Smaller community and fewer resources available
  • Limited features for more complex migration scenarios

Code Comparison

sql-migrate:

-- +migrate Up
CREATE TABLE users (
    id INT AUTO_INCREMENT PRIMARY KEY,
    name VARCHAR(255) NOT NULL,
    email VARCHAR(255) NOT NULL
);

-- +migrate Down
DROP TABLE users;

Flyway:

CREATE TABLE users (
    id INT AUTO_INCREMENT PRIMARY KEY,
    name VARCHAR(255) NOT NULL,
    email VARCHAR(255) NOT NULL
);

Key Differences

  1. Language: sql-migrate is written in Go, while Flyway is written in Java
  2. Migration syntax: sql-migrate uses comments to define up and down migrations, Flyway uses separate files
  3. Database support: Flyway supports a wider range of databases
  4. Community and ecosystem: Flyway has a larger user base and more extensive documentation
  5. Features: Flyway offers more advanced features like callbacks and placeholders

Both tools provide database migration capabilities, but Flyway is generally more feature-rich and widely adopted, while sql-migrate may be preferred for Go-based projects or simpler migration needs.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Flyway by Redgate Build Release Tags Maven Central GitHub license

Database Migrations Made Easy.

Flyway

Evolve your database schema easily and reliably across all your instances.

Simple, focused and powerful.

Works on

Windows, macOS, Linux, Docker and Java

Supported build tools

Maven and Gradle

Supported databases

Aurora MySQL, Aurora PostgreSQL, Azure Synapse, Clickhouse, CockroachDB, Databricks, DB2, Derby, Firebird, Google BigQuery, Google Cloud Spanner, H2, HSQLDB, Informix, MariaDB, MongoDB, MySQL, Oracle, Percona XtraDB Cluster, PostgreSQL, Redshift, SAP HANA (Including SAP HANA Cloud), SingleStoreDB, Snowflake, SQLite, SQL Server, Sybase ASE, TiDB, TimescaleDB, YugabyteDB

Third party plugins

SBT, Ant, Spring Boot, Grails, Play!, DropWizard, Grunt, Griffon, Ninja, ...

Documentation

Download

You can download Flyway from here

About

Flyway is brought to you by Redgate with the help of many contributors.

How to contribute

Please visit our contribution page to find out how you can contribute in various ways to the project.

License

Copyright © Red Gate Software Ltd 2010-2025

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Trademark

Flyway is a registered trademark of Boxfuse GmbH, owned by Red Gate Software Ltd.