Database migrations with Flyway
Manage database schema changes like code with Flyway: why migrations exist, versioned and repeatable migration files, naming rules, the schema history table, using Flyway with Spring Boot, the CLI and Maven or Gradle, checksums and validation, baselining an existing database, and writing safe migrations for zero-downtime deploys.
CodexBash, , 6 min read
Application code lives in git, is reviewed and is deployed the same way everywhere. Database schemas often are not: someone runs an ALTER TABLE by hand on production, forgets to run it on staging, and a deployment fails at 2 a.m. because a column is missing. Database migrations fix this by treating schema changes as versioned files in the repository, applied automatically, in order, exactly once per database. Flyway is one of the most widely used migration tools, especially in the Java world, and its ideas carry over to Liquibase, Alembic, Django migrations and others. This article explains how it works and how to write migrations that do not break production.
Sign in to read the rest
The whole 6 minute article is free with an account, along with every problem, lesson and tutorial. No card.