Why I Actually Use Flyway (And You Should Too)

I've been using Flyway since 2019 because it solves the one problem every team has: database changes are a pain in the ass. Before Flyway, our deployments looked like this: "Hey Dave, did you run those ALTER TABLE statements on staging? What about prod? Oh shit, we forgot to update the indexes."

Now it's just `flyway migrate` and I'm done.

How Flyway Works (The 30-Second Version)

You put SQL files in a folder. Name them V1__something.sql, V2__something_else.sql. Run flyway migrate. That's it.

Flyway keeps a table called flyway_schema_history that tracks what's been run. It won't run the same migration twice, and it runs them in version order. If V3 fails, V4 through V99 won't run until you fix V3.

The genius is in what it doesn't do - no XML config files, no proprietary formats, no learning Hibernate all over again. Just SQL.

Version Reality Check

Latest version as of September 2025 is 11.11.2, released in August. Redgate owns it now (bought it in July 2019) but they haven't fucked it up. Community edition is still free and does everything most teams need.

Word of warning: they keep pushing their Enterprise edition hard. Unless you're managing 20+ databases or need automatic rollbacks (spoiler: they usually don't work anyway), stick with Community.

Why Not Just Write Database Scripts Manually?

Database Migration Problems

Because you will fuck it up. Here's what happens without Flyway:

  • Dev runs migration on their local DB
  • QA forgets to run it on staging
  • Prod deployment explodes with "column doesn't exist" errors
  • You're debugging at 2am while customers are pissed

With Flyway, the same script runs everywhere in the same order. Your staging environment is exactly what prod will look like. When shit breaks (and it will), at least you know why.

The One Thing That Actually Matters

Flyway forces you to treat database changes like code changes. Every schema modification goes through version control. You can see what changed, who changed it, and when. Your database schema becomes as predictable as your application code.

This is huge for teams. No more "database guy" who's the only one allowed to touch production. No more wondering why staging acts differently than prod. No more rollback disasters.

But here's where it gets tricky: Redgate wants you to upgrade to Enterprise. The free Community edition does everything I just described perfectly. I've migrated 47 microservices with Community edition and only had 3 disasters (all my fault, not Flyway's). Whether you need to pay depends on your specific situation - let's break down what you actually get for your money.

Community vs Enterprise: What You Actually Get

What You Need

Community (Free)

Enterprise ($$$)

My Take

Run SQL migrations

✅ Works perfectly

✅ Same engine

Community is fine for 90% of teams

Multiple databases

✅ PostgreSQL, MySQL, SQL Server, Oracle + 40 others

✅ Same support

Zero difference here

CLI/API access

✅ Full access

✅ Same access

They didn't paywall the basics

Auto-rollback scripts

❌ Write by hand

✅ Auto-generated*

Sounds good, usually breaks

Schema drift detection

❌ DIY validation

✅ Built-in reports

Actually useful for larger teams

Migration generation

❌ Write SQL yourself

✅ Generate from schema changes*

Meh, just write SQL

Professional support

❌ Stack Overflow

✅ Redgate support

Worth it if you're enterprise

How Flyway Actually Works (And Where It Breaks)

Database Support: The Good and Ugly

Flyway claims to support 50+ databases. Here's what that actually means:

Works Great: PostgreSQL (9.6+), MySQL (5.7+), SQL Server (2016+), Oracle (12c+). These are the main targets and everything works as advertised. Full DDL support, transactional migrations where supported, clean error reporting.

Works Fine: MariaDB (10.3+), SQLite (3.7+), H2 (1.4+). Minor quirks but nothing that'll kill your deployment. SQLite's ALTER TABLE limitations might surprise you, and H2's compatibility modes can be finicky.

Works With Pain: DB2 (11.1+), Sybase ASE (16.0+), Informix (12.10+). Prepare to debug weird SQL dialect issues and non-standard error messages. Check GitHub issues before committing to these - community support is thin.

Cloud Stuff: Aurora, Azure SQL, Google Cloud SQL all work because they're just rebranded versions of the main databases above.

Trendy Data Platforms: Snowflake support is solid. BigQuery support exists but you'll hit limitations with complex DDL. MongoDB "support" is preview-only and honestly pretty buggy.

Reality Check: Unless you're using PostgreSQL, MySQL, or SQL Server, expect to spend time working around database-specific quirks.

How Migrations Actually Run

Flyway Migration Process

  1. Flyway checks for a flyway_schema_history table. Creates one if it doesn't exist.
  2. It scans your migration folder for V*__.sql files
  3. Compares what's in your folder vs what's been run (stored in that history table)
  4. Runs any missing migrations in version order
  5. Records each successful migration with a checksum

If any migration fails, Flyway stops. No V4 until you fix V3.

File Organization That Won't Cause Pain

db/migration/
├── V1__create_users_table.sql
├── V2__add_email_index.sql
├── V3__insert_admin_user.sql
├── V4__add_password_reset_table.sql
└── V20250901__big_refactor.sql  <- dated versions for major changes

Pro tips from experience:

  • Use double underscores __ not single. Single underscore breaks on some systems. Our entire CI pipeline broke when they changed this default in version 6.0.
  • Keep descriptions short. Windows has path length limits that will bite you in prod.
  • For big releases, I use dated versions like V20250901 so there's room for hotfixes (V20250901.1, etc.). Saved my ass during the Q4 2024 deployment disaster.

Where Flyway Falls Apart

MySQL DDL Rollback: MySQL doesn't support transactional DDL, so if your migration fails halfway through a big ALTER TABLE, you're fucked. MySQL 8.0+ added atomic DDL for some operations, but complex migrations with multiple statements still leave you in an inconsistent state. Flyway can't roll it back automatically - you'll need manual cleanup.

Checksum Hell: Change one character in an old migration? Flyway throws a fit with "Migration checksum mismatch" errors. The checksum validation uses CRC32 on file contents, which prevents you from modifying historical migrations. Usually good for preventing accidental changes, but occasionally infuriating when you need to fix a typo in V1 from three years ago.

Large Migrations: That 2-hour data migration that transforms 100M rows? Flyway will sit there and wait with zero feedback. No progress updates, no way to resume if it fails, no timeout handling. The migration either completes or your connection dies and you're left wondering what state your data is in. I learned this the hard way when our user analytics migration took down staging for 6 hours. Plan accordingly with chunked updates or external batch jobs.

Parallel Deployments: Two deployments hit the same database at once? Flyway uses a lock table (flyway_schema_history_lock) to prevent concurrent migrations, but I've still seen race conditions in high-concurrency environments cause deployments to fail with "table already exists" errors or lock timeouts exceeding 20 seconds.

Integration Reality Check

Spring Boot: Works perfectly out of the box. Just drop migration files in src/main/resources/db/migration/. See the Spring Boot integration guide. AWS RDS works perfectly. Azure SQL has weird timeout issues. Google Cloud SQL is fine but their managed backups don't snapshot mid-migration.

Spring Boot Flyway Integration

Docker: The official Flyway Docker image works fine for CI/CD. I use it in GitHub Actions.

Gradle/Maven: Plugins work but the configuration is verbose. Most teams just use the CLI.

Kubernetes: Works but migrations run in init containers can timeout. Set your resource limits appropriately.

These are the fundamentals, but real projects always hit edge cases. Flyway works great until you have 47 microservices all trying to migrate at deploy time. The Docker image is fine but good luck debugging why it works locally and fails in K8s. The questions below come from actual issues I've solved (or caused) over the years. If you're dealing with a broken deployment or weird migration behavior, start here.

Questions I Actually Get Asked About Flyway

Q

My migration failed halfway through and now I can't deploy. What the fuck?

A

This happens. A lot. Here's what to do:

  1. Check flyway_schema_history table - the failed migration will be marked with success = 0 and execution_time shows how long it ran before failing
  2. If you're on PostgreSQL/SQL Server, the failed changes rolled back automatically (transactional DDL)
  3. If you're on MySQL, you're probably screwed because DDL doesn't roll back. Check what actually got created/changed with SHOW TABLES and DESCRIBE table_name
  4. Fix the broken SQL in your migration file (common issues: missing semicolons, syntax errors, constraint violations)
  5. Run flyway repair to mark the failed migration as resolved (this deletes the failed entry from the history table)
  6. Run flyway migrate again

Pro tip: Test big migrations on staging first. Always. And keep your migration files small - one logical change per file.

Q

Two developers created V5 migrations at the same time. Now what?

A

Git conflict resolution, database edition. One of you needs to rename their migration to V6. Flyway runs migrations in version order, so this matters.

If you've already run the migrations in different environments:

  1. Rename the later migration to the next available version
  2. Use flyway repair to clean up the history table if needed
  3. Consider using dated versions (V20250901) for releases to avoid conflicts
Q

Can I modify an old migration that's already been deployed?

A

No. Flyway checksums every migration. Change one character and it'll refuse to run.

If you absolutely must fix an old migration:

  1. Create a new migration to fix the issue
  2. Or use flyway repair to reset the checksum (dangerous)
  3. Or just live with it (recommended)
Q

The auto-rollback in Enterprise doesn't work. Now what?

A

Yeah, auto-rollback is marketing bullshit for anything complex. It works for simple ADD COLUMN changes but breaks on:

  • Foreign key constraints
  • Triggers and stored procedures
  • Complex data transformations
  • Renamed columns

Write manual rollback scripts like the rest of us. Name them U5__rollback_whatever.sql and run flyway undo.

Q

How do I handle environment-specific data?

A

Don't put environment data in migrations. Use profiles or conditional SQL:

-- V5__insert_admin_users.sql
INSERT INTO users (email, role) 
SELECT 'admin@localhost', 'admin'
WHERE '${environment}' = 'local';

INSERT INTO users (email, role)  
SELECT 'admin@company.com', 'admin'
WHERE '${environment}' = 'production';

Or keep environment data in separate files outside of migrations.

Q

Can I use Flyway with an existing database?

A

Yes, use flyway baseline. This tells Flyway "everything up to now is V1, start tracking from here."

flyway baseline -baselineVersion=1 -baselineDescription="Legacy schema"

But you'll need to recreate your existing schema in V1__.sql if you want new environments to match.

Q

My migration is taking 2 hours to run. Is Flyway broken?

A

Flyway doesn't do progress updates for long-running migrations. If you're transforming millions of rows:

  1. Break it into smaller chunks
  2. Use a separate batch job, not a migration
  3. Or just wait it out and pray nothing times out (time estimates: 5 minutes if lucky, 2 hours if not)

The checksum validation has screwed me more times than it's helped. For zero-downtime deployments, use online schema change tools like gh-ost (MySQL) or pg_repack (PostgreSQL).

Q

Should I use Community or pay for Enterprise?

A

Community unless you're managing 20+ databases or your company requires paid support. Most teams think they need Enterprise but Community handles like 95% of real usage. We're still on Community because our VP won't pay for 'database stuff' but approved $50K for a Slack bot.

Enterprise features sound amazing but:

  • Auto-rollbacks mostly don't work
  • Schema drift detection is nice but not essential
  • Professional support is good if you can afford it

Save the money and just write better migrations.

Q

How do I debug "Migration checksum mismatch" errors?

A

Someone modified an old migration file. Check git log on the file to see who.

Quick fixes:

## See what changed
flyway info

## Reset the checksum (DANGEROUS in prod)
flyway repair

## Or just revert the file change

Never use flyway repair in production without understanding what changed.

Q

Does Flyway work with Docker/Kubernetes?

A

Yes. Use the official Docker image in your deployment pipeline:

Flyway Docker Container

docker run --rm -v $(pwd)/migrations:/flyway/sql flyway/flyway migrate

In Kubernetes, run it as an init container before your app starts. Just make sure your resource limits don't timeout on long migrations.

Database Migration CI/CD Pipeline

These FAQs cover the disasters I've personally encountered. For everything else, you'll need the official docs and community resources. Here's where to go when Google fails you.

Related Tools & Recommendations

tool
Similar content

Liquibase Overview: Automate Database Schema Changes & DevOps

Because manually deploying schema changes while praying is not a sustainable strategy

Liquibase
/tool/liquibase/overview
100%
troubleshoot
Similar content

Fix MySQL Error 1045 Access Denied: Solutions & Troubleshooting

Stop fucking around with generic fixes - these authentication solutions are tested on thousands of production systems

MySQL
/troubleshoot/mysql-error-1045-access-denied/authentication-error-solutions
56%
alternatives
Recommended

Maven is Slow, Gradle Crashes, Mill Confuses Everyone

integrates with Apache Maven

Apache Maven
/alternatives/maven-gradle-modern-java-build-tools/comprehensive-alternatives
54%
compare
Recommended

PostgreSQL vs MySQL vs MongoDB vs Cassandra - Which Database Will Ruin Your Weekend Less?

Skip the bullshit. Here's what breaks in production.

PostgreSQL
/compare/postgresql/mysql/mongodb/cassandra/comprehensive-database-comparison
44%
integration
Recommended

Fix Your Slow-Ass Laravel + MySQL Setup

Stop letting database performance kill your Laravel app - here's how to actually fix it

MySQL
/integration/mysql-laravel/overview
40%
tool
Similar content

Neon Production Troubleshooting Guide: Fix Database Errors

When your serverless PostgreSQL breaks at 2AM - fixes that actually work

Neon
/tool/neon/production-troubleshooting
37%
tool
Similar content

PostgreSQL Performance Optimization: Master Tuning & Monitoring

Optimize PostgreSQL performance with expert tips on memory configuration, query tuning, index design, and production monitoring. Prevent outages and speed up yo

PostgreSQL
/tool/postgresql/performance-optimization
37%
tool
Similar content

Redis Overview: In-Memory Database, Caching & Getting Started

The world's fastest in-memory database, providing cloud and on-premises solutions for caching, vector search, and NoSQL databases that seamlessly fit into any t

Redis
/tool/redis/overview
36%
tool
Similar content

Firebase - Google's Backend Service for Serverless Development

Skip the infrastructure headaches - Firebase handles your database, auth, and hosting so you can actually build features instead of babysitting servers

Firebase
/tool/firebase/overview
36%
tool
Similar content

MongoDB Overview: How It Works, Pros, Cons & Atlas Costs

Explore MongoDB's document database model, understand its flexible schema benefits and pitfalls, and learn about the true costs of MongoDB Atlas. Includes FAQs

MongoDB
/tool/mongodb/overview
35%
tool
Similar content

Redis Cluster Production Issues: Troubleshooting & Survival Guide

When Redis clustering goes sideways at 3AM and your boss is calling. The essential troubleshooting guide for split-brain scenarios, slot migration failures, and

Redis
/tool/redis/clustering-production-issues
35%
tool
Similar content

ClickHouse Overview: Analytics Database Performance & SQL Guide

When your PostgreSQL queries take forever and you're tired of waiting

ClickHouse
/tool/clickhouse/overview
34%
tool
Similar content

PostgreSQL: Why It Excels & Production Troubleshooting Guide

Explore PostgreSQL's advantages over other databases, dive into real-world production horror stories, solutions for common issues, and expert debugging tips.

PostgreSQL
/tool/postgresql/overview
33%
tool
Similar content

PostgreSQL Logical Replication: When Streaming Isn't Enough

Unlock PostgreSQL Logical Replication. Discover its purpose, how it differs from streaming replication, and a practical guide to setting it up, including tips f

PostgreSQL
/tool/postgresql/logical-replication
33%
tool
Similar content

Neon Serverless PostgreSQL: An Honest Review & Production Insights

PostgreSQL hosting that costs less when you're not using it

Neon
/tool/neon/overview
33%
tool
Similar content

Cassandra Vector Search for RAG: Simplify AI Apps with 5.0

Learn how Apache Cassandra 5.0's integrated vector search simplifies RAG applications. Build AI apps efficiently, overcome common issues like timeouts and slow

Apache Cassandra
/tool/apache-cassandra/vector-search-ai-guide
31%
tool
Similar content

etcd Overview: The Core Database Powering Kubernetes Clusters

etcd stores all the important cluster state. When it breaks, your weekend is fucked.

etcd
/tool/etcd/overview
31%
troubleshoot
Similar content

Fix MongoDB "Topology Was Destroyed" Connection Pool Errors

Production-tested solutions for MongoDB topology errors that break Node.js apps and kill database connections

MongoDB
/troubleshoot/mongodb-topology-closed/connection-pool-exhaustion-solutions
31%
tool
Similar content

DuckDB: The SQLite for Analytics - Fast, Embedded, No Servers

SQLite for analytics - runs on your laptop, no servers, no bullshit

DuckDB
/tool/duckdb/overview
30%
tool
Similar content

Prisma ORM: TypeScript Client, Setup Guide, & Troubleshooting

Database ORM that generates types from your schema so you can't accidentally query fields that don't exist

Prisma
/tool/prisma/overview
30%

Recommendations combine user behavior, content similarity, research intelligence, and SEO optimization