Flyway Database Migrations: Java, Python, Node.js & CI/CD

Devops & Infrastructure, Security, Tips & Tricks, and What Is

Flyway Database Migrations: Java, Python, Node.js & CI/CD

Application code gets version control, automated tests, and one-click deployments. Database schemas? Often they're still managed with hand-run SQL scripts and whispered tribal knowledge. That gap between code deployment and database deployment is where things break.

Flyway is a database migration tool that brings version control principles to your schema. You write numbered SQL files, Flyway tracks what's been applied, and every environment stays in sync. Combined with DeployHQ's build pipeline integration, you can automate database migrations as a pre-deployment step --- so your schema and code always ship together.

This guide covers what Flyway is, how it works, how to use it with JVM, Python, and Node.js projects, and how to integrate it into your deployment workflow. Examples are written against Flyway 13.12.0, the current release at the time of writing.

What Is Flyway?

Flyway is an open-source database migration tool developed by Redgate. It applies versioned SQL scripts to your database in a deterministic order, tracking which migrations have already run so they are never re-applied. Think of it as Git for your database schema --- every change is an immutable, ordered script that moves the schema from one known state to the next.

Under the hood, Flyway maintains a metadata table (flyway_schema_history) inside your database. Each row records a migration's version number, description, checksum, and execution timestamp. When you run flyway migrate, it compares the scripts on disk against this table and applies only the pending ones. If someone edits an already-applied script, the checksum mismatch halts execution immediately --- preventing silent schema corruption that manual SQL workflows can't catch.

Redgate says Flyway's foundational commands support 50+ database systems (PostgreSQL, MySQL, Oracle, SQL Server, SQLite, MariaDB, CockroachDB, Snowflake, and many more). It works with any programming language via its CLI, and integrates natively with JVM build tools like Maven and Gradle.

What's changed in recent Flyway versions

If you last touched Flyway a few years ago, these changes will trip you up:

  • Database support is modular (Flyway 10+) --- PostgreSQL, MySQL and many other databases now need a separate module such as flyway-database-postgresql or flyway-mysql on the classpath. Without it, Java/Maven/Gradle builds fail with No Flyway database plugin found to handle: jdbc:...
  • TOML is the default config format --- the CLI quickstart now configures Flyway through conf/flyway.toml. Legacy .conf files are still accepted
  • Two sets of artifacts --- open-source builds are published under org.flywaydb; Redgate's edition (Community, plus paid features with a licence) moved to the com.redgate.flyway group ID at Flyway 10
  • Java 17 now, Java 21 soon --- the Java API requires JDK 17+, and Redgate's docs state that Flyway v14 will require Java 21
  • Spring Boot 4 needs a starter --- spring-boot-starter-flyway replaces the bare flyway-core dependency
  • Flyway 13 (July 2026) added a Flyway MCP server for AI assistants

The Database Migration Problem

When database changes are managed manually, teams run into predictable problems:

  • Schema drift --- development, staging, and production databases diverge, causing works on my machine failures
  • Error-prone deployments --- running SQL scripts by hand is tedious and one wrong statement can cause downtime
  • No audit trail --- no record of who changed what, when, or why
  • Difficult rollbacks --- reverting a schema change is far harder than reverting a code commit

Migration tools solve this by treating schema changes as versioned, sequential scripts that are applied automatically. For a tool-agnostic overview of the problem, see our guide on how to handle database changes during a deployment.

How Flyway Works

Flyway operates on a straightforward principle: versioned migration scripts.

flowchart LR
    A["Write SQL\nmigration"] --> B["flyway validate"]
    B --> C["flyway migrate"]
    C --> D["Verify\nschema state"]
    D --> E["Deploy\napplication"]
    E --> F{"Issues?"}
    F -- No --> G["Done"]
    F -- Yes --> H["Rollback\nmigration"]
    H --> A
  1. You write migration files --- plain SQL files with version numbers: V1__create_users_table.sql, V2__add_email_column.sql
  2. Flyway tracks state --- a flyway_schema_history table in your database records every applied migration, its checksum, and when it ran
  3. Flyway applies the diff --- on each run, it compares your migration files against the history table and applies only the pending ones, in order
  4. Checksums catch tampering --- if an already-applied script is modified, Flyway detects the mismatch and stops, preventing silent corruption
  5. Every environment stays in sync --- the same migrations run in dev, staging, and production, eliminating drift

Versioned vs repeatable migrations

Alongside versioned V scripts, Flyway supports repeatable migrations with an R__ prefix and no version number (for example R__refresh_reporting_views.sql). Flyway re-applies a repeatable migration whenever its checksum changes, and always runs repeatables after all pending versioned migrations. They're the right home for views, stored procedures, and functions --- write them with CREATE OR REPLACE so they're safe to re-run.

Flyway for JVM Projects

Flyway originated in the Java ecosystem and integrates deeply with JVM build tools. The examples below use the open-source org.flywaydb artifacts and PostgreSQL.

Add the database module first

Since Flyway 10, the core library no longer contains support for most databases. For PostgreSQL you need org.flywaydb:flyway-database-postgresql; for MySQL, org.flywaydb:flyway-mysql. Add the module next to flyway-core (plus your JDBC driver), or Flyway won't recognise your JDBC URL. If you use Redgate's edition instead, the same modules exist under com.redgate.flyway and are served from https://download.red-gate.com/maven/release.

Java API

Run migrations programmatically --- useful for applying them on application startup. The Java API requires JDK 17 or later:

import org.flywaydb.core.Flyway;

public class DatabaseMigrator {
    public static void main(String[] args) {
        Flyway flyway = Flyway.configure()
            .dataSource("jdbc:postgresql://localhost:5432/mydb", "user", "password")
            .locations("classpath:db/migration")
            .load();
        flyway.migrate();
        System.out.println("Database migration completed successfully!");
    }
}

Maven Plugin

Add Flyway to your build lifecycle. The database module and JDBC driver go in the plugin's own <dependencies> block:

<build>
    <plugins>
        <plugin>
            <groupId>org.flywaydb</groupId>
            <artifactId>flyway-maven-plugin</artifactId>
            <version>13.12.0</version>
            <configuration>
                <url>jdbc:postgresql://localhost:5432/mydb</url>
                <user>user</user>
                <password>password</password>
                <locations>
                    <location>classpath:db/migration</location>
                </locations>
            </configuration>
            <dependencies>
                <dependency>
                    <groupId>org.flywaydb</groupId>
                    <artifactId>flyway-database-postgresql</artifactId>
                    <version>13.12.0</version>
                </dependency>
                <dependency>
                    <groupId>org.postgresql</groupId>
                    <artifactId>postgresql</artifactId>
                    <version>42.7.14</version>
                </dependency>
            </dependencies>
        </plugin>
    </plugins>
</build>

Run with: mvn flyway:migrate

Gradle Plugin

Gradle loads the database module through buildscript dependencies (the buildscript block must come before plugins):

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath "org.flywaydb:flyway-database-postgresql:13.12.0"
        classpath "org.postgresql:postgresql:42.7.14"
    }
}

plugins {
    id "org.flywaydb.flyway" version "13.12.0"
}

flyway {
    url = 'jdbc:postgresql://localhost:5432/mydb'
    user = 'user'
    password = 'password'
    locations = ['classpath:db/migration']
}

Run with: gradle flywayMigrate

Spring Boot Integration

Spring Boot 3.x auto-configures Flyway when you add the flyway-core dependency --- migrations run automatically on startup from src/main/resources/db/migration. On Flyway 10 and later, remember to add the database module (for example flyway-database-postgresql) as well.

Note: Spring Boot 4.x changed this --- the Spring Boot 4.0 migration guide says to replace the plain Flyway dependency with spring-boot-starter-flyway.

Transactions and non-transactional DDL

By default, Flyway wraps each migration script in its own transaction. If a statement fails, Flyway rolls back where the database allows it and stops processing further migrations.

Two gotchas worth knowing:

  • Databases with implicit commits around DDL (such as MySQL) may not be able to roll back a failed DDL migration cleanly. Flyway marks the migration as failed instead, and you'll need to clean up by hand and run flyway repair (see Troubleshooting below)
  • PostgreSQL CREATE INDEX CONCURRENTLY can conflict with Flyway's default transactional lock. Redgate's PostgreSQL docs recommend setting flyway.postgresql.transactional.lock=false, which switches Flyway to a session-level lock (test this on your Flyway version, as some versions have had reports of hangs). You can also mark an individual SQL migration as non-transactional with the executeInTransaction script configuration property

If you'd rather apply a whole batch atomically, the group setting (default false) runs all pending migrations in a single transaction. Redgate recommends it only for databases that support transactional DDL.

Flyway for Non-JVM Projects

Flyway's command-line interface works with any language or framework. The platform-specific CLI downloads (Windows, macOS x64/arm64, Linux) ship with a jre/ folder, so you don't need Java installed separately. A Docker image (redgate/flyway) is also available.

1. Configure your connection

Create a flyway.toml file --- TOML is the format used in Redgate's current CLI quickstart:

[environments.default]
url = "jdbc:mysql://localhost:3306/mydb"
user = "root"
# Don't commit passwords: set FLYWAY_PASSWORD in the environment instead

[flyway]
locations = ["filesystem:sql/migrations"]

Legacy flyway.conf files (flyway.url=..., flyway.user=...) still work if you have existing projects.

MySQL gotcha: the CLI does not ship MySQL Connector/J. Drop the Connector/J jar into the CLI's drivers/ folder. Without it, Flyway falls back to the bundled MariaDB driver --- which, since Flyway 10.7.0, rejects jdbc:mysql: URLs unless you add permitMysqlScheme=true. PostgreSQL's JDBC driver is bundled with the CLI.

2. Organise your migration scripts

sql/migrations/
  V1__create_products_table.sql
  V2__add_price_column.sql
  V3__create_orders_table.sql

Version numbers can use dots or underscores as separators (V2.1__ and V2_1__ are both valid).

3. Run migrations

flyway -configFiles=flyway.toml migrate

4. Integrate with CI/CD

Add Flyway as a pre-deployment step in your pipeline. Here's a shell script example:

#!/bin/bash

export FLYWAY_URL="jdbc:postgresql://${DB_HOST}:${DB_PORT}/${DB_NAME}"
export FLYWAY_USER="${DB_USER}"
export FLYWAY_PASSWORD="${DB_PASSWORD}"
export FLYWAY_LOCATIONS="filesystem:./db/migrations"

echo "Running Flyway migrations..."
./flyway migrate

if [ $? -eq 0 ]; then
    echo "Flyway migrations completed successfully!"
else
    echo "Flyway migrations failed!"
    exit 1
fi

In DeployHQ, you can run this as a build pipeline command or as an SSH command that runs before the deployment, with database credentials stored securely as environment variables. Pick the location carefully: build pipeline commands run on DeployHQ's build servers, so your database has to be reachable from there. If your database only accepts connections from your own network, run flyway migrate as a pre-deployment SSH command on the application server instead, and enable the option to stop the deployment if the command fails.

Ship schema and code together: with DeployHQ's Git deployment automation, every push to your deployment branch can run your migrations and release the matching code in one step --- no more remembering to run SQL by hand.

Flyway with Python Projects

Python projects commonly use Alembic or Django migrations (see our Flask and SQLAlchemy migrations guide for the Alembic route), but Flyway is a strong choice when your team manages multiple services across different languages and wants a single migration tool for all of them. The Flyway CLI runs SQL migrations regardless of your application language.

Using the Flyway CLI from Python

The most reliable approach is calling the Flyway CLI directly from your Python build or deployment scripts:

import subprocess
import sys
import os

def run_flyway_migrate():
    """Run Flyway migrations as part of the deployment pipeline."""
    env = os.environ.copy()
    env.update({
        "FLYWAY_URL": f"jdbc:postgresql://{os.getenv('DB_HOST', 'localhost')}:5432/{os.getenv('DB_NAME', 'mydb')}",
        "FLYWAY_USER": os.getenv("DB_USER", "postgres"),
        "FLYWAY_PASSWORD": os.getenv("DB_PASSWORD", ""),
        "FLYWAY_LOCATIONS": "filesystem:./db/migrations",
    })

    result = subprocess.run(
        ["flyway", "migrate"],
        env=env,
        capture_output=True,
        text=True,
    )

    if result.returncode != 0:
        print(f"Migration failed:\n{result.stderr}", file=sys.stderr)
        sys.exit(1)

    print(result.stdout)
    print("Flyway migrations applied successfully.")

if __name__ == "__main__":
    run_flyway_migrate()

Python script migrations

Flyway can also run script migrations alongside SQL ones. Supported extensions include .py, .sh, .bash, .ps1, .bat and .cmd, using the same naming scheme as SQL files (for example V4__backfill_slugs.py). This is handy for data backfills that are awkward in pure SQL. One caveat from Redgate's docs: the checksum covers only the script file itself, not any modules or files it imports.

What about the flyway package on PyPI?

The flyway package on PyPI is not an official Redgate wrapper around the Flyway CLI. It's an independent, community-maintained Python migrator (version 0.2.0 at the time of writing, Python 3.11+) that takes a DB-API connection and applies V<version>__description.sql files itself:

pip install flyway
import sqlite3
from flyway import Migrator, MigratorConfig, DbType

conn = sqlite3.connect("example.db")
config = MigratorConfig(db_type=DbType.SQLITE, user="admin")
Migrator(conn, config).migrate()  # reads db/migration/ by default

It can be convenient for small projects, but it isn't the Flyway engine, so features such as validate, repair, baseline and Redgate support don't carry over. For production CI/CD pipelines, install the official Flyway CLI.

Project structure

A typical Python project using Flyway:

my-python-app/
  app/
    __init__.py
    main.py
  db/
    migrations/
      V1__create_users.sql
      V2__add_sessions_table.sql
  flyway.toml
  requirements.txt
  deploy.py           # calls flyway migrate

Flyway with Node.js Projects

Node.js projects typically use tools like Prisma Migrate or Knex migrations, but Flyway works well when you need a language-agnostic migration tool across a polyglot stack --- for example, when your Node.js API shares a database with Java microservices.

Using the Flyway CLI from Node.js

Call the Flyway CLI as a child process in your deployment scripts:

// scripts/migrate.js
const { execSync } = require("child_process");

const env = {
  ...process.env,
  FLYWAY_URL: `jdbc:postgresql://${process.env.DB_HOST || "localhost"}:5432/${process.env.DB_NAME || "mydb"}`,
  FLYWAY_USER: process.env.DB_USER || "postgres",
  FLYWAY_PASSWORD: process.env.DB_PASSWORD || "",
  FLYWAY_LOCATIONS: "filesystem:./db/migrations",
};

try {
  const output = execSync("flyway migrate", { env, encoding: "utf-8" });
  console.log(output);
  console.log("Flyway migrations applied successfully.");
} catch (error) {
  console.error("Migration failed:", error.stderr || error.message);
  process.exit(1);
}

npm scripts integration

Add migration commands to your package.json:

{
  "scripts": {
    "db:migrate": "flyway -configFiles=flyway.toml migrate",
    "db:validate": "flyway -configFiles=flyway.toml validate",
    "db:info": "flyway -configFiles=flyway.toml info",
    "predeploy": "npm run db:migrate"
  }
}

This lets you run npm run db:migrate locally and hook it into your DeployHQ build pipeline as a build step.

Project structure

my-node-app/
  src/
    index.ts
    routes/
  db/
    migrations/
      V1__create_accounts.sql
      V2__add_api_keys_table.sql
  flyway.toml
  package.json
  scripts/
    migrate.js

Rollback Strategies

Rolling back database migrations is harder than rolling back application code --- you can't simply revert a SQL file that has already altered your schema. Flyway provides several approaches depending on your edition and requirements.

Undo migrations (paid editions)

flyway undo is a paid feature: Redgate's documentation tags it as a Flyway Teams-tier command, and Redgate's current paid edition is Flyway Enterprise. For each versioned migration, you write a corresponding undo script:

db/migrations/
  V1__create_users.sql
  U1__drop_users.sql
  V2__add_email_column.sql
  U2__remove_email_column.sql

Running flyway undo reverses the most recently applied versioned migration. Set target to keep undoing in reverse order down to a given version. Repeatable (R__) migrations can't be undone --- change the repeatable script back to the state you want and run migrate again.

Compensation migrations (Community and open source)

The free editions do not include undo. Instead, the standard pattern is to write a new forward migration that reverses the effect of the problematic one:

-- V3__rollback_add_email_column.sql
-- Compensation migration: reverses V2__add_email_column.sql

ALTER TABLE users DROP COLUMN IF EXISTS email;

This keeps your migration history moving forward --- every change is recorded and auditable, even rollbacks.

Best practices for rollback-safe migrations

  1. Make migrations additive --- prefer ADD COLUMN over DROP COLUMN. Additive changes are inherently backward-compatible and don't require immediate rollback scripts
  2. Use phased removals --- to drop a column, first deploy code that stops reading it, then add a migration to remove it in a later release
  3. Test undo scripts --- if you use the paid undo command, test undo scripts in CI just as you test forward migrations
  4. Always back up before migrating production --- no rollback strategy replaces a known-good database backup
  5. Consider zero-downtime database migration strategies such as expand-and-contract for high-availability systems where rollback must be instant

Keep the app online while the schema changes: pair additive migrations with DeployHQ's zero downtime deployments, so the new release only goes live once its files are fully in place.

Key Features

  • Plain SQL migrations --- write standard SQL, no proprietary syntax required
  • Checksum validation --- prevents silent modifications to already-applied scripts
  • Baseline support --- bring an existing database under Flyway control without replaying history
  • Validation --- detect inconsistencies between your scripts and database state with flyway validate
  • Clean command --- wipe schemas for dev/test environments. Warning: this drops ALL objects in configured schemas. Never use in production. cleanDisabled defaults to true --- keep it that way in every production config
  • Undo migrations --- a paid feature (see Rollback Strategies above). The free editions rely on compensation migrations
  • 50+ databases supported --- MySQL, PostgreSQL, Oracle, SQL Server, SQLite, MariaDB, CockroachDB, Snowflake, and many more

Best Practices

  1. One change per migration --- each script should be a single, atomic schema change. Don't bundle unrelated changes
  2. Descriptive names --- V3__add_index_on_users_email.sql is better than V3__update.sql
  3. Test before production --- run migrations in staging first (managing dev, staging, and production environments covers the setup). Tools like Testcontainers can spin up isolated databases for automated testing
  4. Design for backward compatibility --- avoid destructive changes (dropping columns) if the current app version depends on them. Use a phased approach: deprecate first, remove in a later migration
  5. Commit migrations to Git --- store them alongside your application code so schema history tracks with your codebase. Deploy from GitHub or GitLab and DeployHQ picks them up automatically
  6. Automate with CI/CD --- run migrations as a pre-deployment step, not manually. DeployHQ's build pipeline handles this natively
  7. Use minimal database privileges --- create a dedicated migration user with only the permissions Flyway needs
  8. Always back up before migrating production --- Flyway is reliable, but backups are non-negotiable

Troubleshooting Common Flyway Errors

Checksum mismatch

ERROR: Migration checksum mismatch for migration version 3
-> Applied to database : 1234567890
-> Resolved locally    : 9876543210

Cause: Someone edited a migration file after it was already applied to the database. Flyway refuses to continue because the script on disk no longer matches what was executed.

Fix: If the edit was intentional (e.g., fixing a comment), run flyway repair to realign the stored checksum. If the edit changed actual SQL, write a new migration instead --- never modify applied scripts.

Out-of-order migrations

ERROR: Detected resolved migration not applied to database: 2.1

Cause: A migration with a lower version number was added after a higher version was already applied. This happens when two developers create migrations in parallel.

Fix: Enable out-of-order execution in your config:

[flyway]
outOfOrder = true

(In a legacy .conf file: flyway.outOfOrder=true; as an environment variable: FLYWAY_OUT_OF_ORDER=true.)

This tells Flyway to apply any pending migration regardless of version ordering. Use this cautiously --- it works well for additive changes but can cause issues if migrations have interdependencies.

Existing database without a schema history table

ERROR: Found non-empty schema(s) "public" but no schema history table. Use baseline() or set baselineOnMigrate to true to initialize the schema history table.

Cause: You pointed Flyway at a database that already has tables but has never been managed by Flyway --- the typical situation when adopting Flyway on an existing project.

Fix: Run flyway baseline once to record the current state as your starting version, or set baselineOnMigrate=true so migrate does it automatically. Then add new changes as migrations above the baseline version.

Failed migration leaves database in dirty state

ERROR: Detected failed migration to version 5 (add_orders_table)

Cause: A migration failed partway through. On databases that implicitly commit DDL (like MySQL), the partial changes remain applied but Flyway marks the migration as failed.

Fix:

  1. Manually inspect and fix the database state --- repair won't undo objects a failed script left behind
  2. Run flyway repair to remove the failed migration record from the history table
  3. Fix the migration script and re-run flyway migrate

Missing database module

No Flyway database plugin found to handle: jdbc:postgresql://...

Cause: On Flyway 10+, the database module for your engine (for example flyway-database-postgresql) isn't on the classpath, or the JDBC URL is misspelt.

Fix: Add the module as shown in the JVM section above, and double-check the URL format against Redgate's database reference page for your engine.

Connection refused or authentication failures

ERROR: Unable to obtain connection from database

Cause: Wrong JDBC URL, incorrect credentials, or the database server is unreachable.

Fix: Verify your connection details. Test with a direct database client first:

# PostgreSQL
psql -h localhost -p 5432 -U user -d mydb

# MySQL
mysql -h localhost -P 3306 -u root -p mydb

Then confirm the JDBC URL format matches your database. Common mistakes include using mysql:// instead of jdbc:mysql:// or forgetting the port number. If the error only happens in CI, check that the database accepts connections from the machine running Flyway.

How Flyway Works with DeployHQ

DeployHQ supports Flyway through its build pipeline and hook system:

  • Build pipelines --- run flyway migrate (or Maven/Gradle commands) as a build step before files are deployed. Build commands run on DeployHQ's servers, so the database must be reachable from there
  • Deployment checks (beta) --- run an SSH command such as flyway validate before the build starts to block the release when migration scripts have drifted from what's already applied. This needs Flyway installed on, and database access from, the server the check connects to
  • Pre-deployment SSH commands --- execute migrations directly on your server before the new code goes live, and stop the deployment if the command fails
  • Environment variables --- store DB_HOST, DB_USER, DB_PASSWORD securely without hardcoding credentials (see managing secrets with .env files and environment variables)
  • Deployment history --- full visibility into every deployment, including migration outcomes
  • One-click rollback --- revert your application deployment if a migration causes issues (your schema still needs a compensation migration or undo script)
  • Deploy from GitHub or GitLab --- your migration scripts deploy alongside your code from any provider

For a broader look at how other frameworks handle database migrations during deployments, see our guides on .NET database migrations with DbUp and deploying EF Core migrations with migration bundles.

Flyway vs Alternatives

Flyway isn't the only migration tool. Here's how it compares:

Tool Ecosystem Key Difference
Liquibase Java / cross-platform Supports XML/YAML/JSON changelogs in addition to SQL. More enterprise-oriented
Alembic Python (SQLAlchemy) Auto-generates migrations from model changes. Python-native
Prisma Migrate Node.js / TypeScript Schema-first approach with auto-generated SQL
Atlas Go / cross-platform Declarative schema-as-code with HCL syntax
Django Migrations Python (Django) Built into the framework, auto-detects model changes

Flyway's strength is its simplicity: plain SQL files, no proprietary format, and it works with any language via the CLI.

Licensing

Flyway is available in three forms:

  • Open Source Flyway (free, Apache 2.0) --- the flyway/flyway project, published under the org.flywaydb group ID. Core migration features, checksum validation, CLI + Maven + Gradle support
  • Flyway Community (free) --- Redgate's own edition, aimed at individual developers and education, published under com.redgate.flyway. The same binaries unlock paid features when you add a licence
  • Flyway Enterprise (paid) --- adds features such as undo scripts, drift detection and reporting, and script generation using Redgate's comparison engine. Pricing is quote-based; Redgate offers a 28-day free trial

You'll still see Flyway Teams in Redgate's docs as the tier label on features such as undo and dry runs, but Redgate's Flyway product page currently lists only Community and Enterprise.

The free editions cover the majority of use cases.

FAQ

Q: Does Flyway work with MySQL? A: Yes. Flyway supports 50+ databases including MySQL, PostgreSQL, Oracle, SQL Server, SQLite, MariaDB, and CockroachDB. For MySQL, add the flyway-mysql module in Java builds, and put MySQL Connector/J in the CLI's drivers/ folder.

Q: Do I need Java installed to use Flyway? A: Not if you use the platform-specific CLI downloads --- they ship with a bundled JRE. The Java API and Maven/Gradle plugins need JDK 17+ today, and Redgate says Flyway v14 will require Java 21.

Q: Can I use Flyway with a Node.js or Python project? A: Yes. Use the Flyway CLI to run migrations from any language. See the dedicated Python and Node.js sections above for integration examples.

Q: Is Flyway free? A: Open Source Flyway and Flyway Community are free. Flyway Enterprise is a paid edition with quote-based pricing that adds features such as undo scripts and drift detection. See Redgate's Flyway product page for current details.

Q: What happens if I accidentally modify an already-applied migration? A: Flyway detects the checksum mismatch and halts, preventing further migrations. You can use flyway repair to realign the stored checksum if the change was intentional. See the Troubleshooting section above for details.

Q: How do I roll back a Flyway migration? A: The paid editions provide the flyway undo command. With the free editions, write a compensation migration --- a new forward migration that reverses the previous change. See Rollback Strategies above for full details.


Database migrations don't have to be a manual, error-prone process. Flyway gives you version-controlled, repeatable schema changes --- and when paired with DeployHQ's automated deployments, those migrations run automatically as part of every deployment.

Start your free DeployHQ trial and automate your database migrations alongside your code deployments.


Questions? Reach out at support@deployhq.com or @deployhq.