What is Database Migration?
A versioned, scripted change to database schema or data, applied incrementally so all environments evolve in a controlled, repeatable way.
Definition
A database migration is a versioned script that alters schema or data — adding a column, backfilling values, creating an index — applied in order so every environment converges on the same structure. Tools like Flyway, Liquibase, Alembic, Prisma Migrate, and Rails Active Record migrations track which versions have run in a metadata table. Safe migrations on live systems follow the expand–contract pattern: add the new column, deploy code that writes both, backfill, then drop the old column, keeping each step backward compatible so deploys and rollbacks never strand the schema.

