Database Migrations
ExplainedConcept
Also known as: Migraties
Version control for database schemas: scripts that change the schema in a controlled way.
Database Migrations, explained
Written by EduVerseWhat it is
A database migration is a small, versioned script that changes the structure of a database, such as adding a table, renaming a column or creating an index. Migrations live in the repository next to the code and run in a fixed order. A tool keeps track of which ones a database has already received.
Why teams use it
Without migrations, every developer and every environment drifts into its own slightly different schema, and nobody knows exactly what production looks like. With them, the schema changes in reviewed, repeatable steps, and a fresh database can be rebuilt from scratch by running them all.
An example from work
You pull the latest main, start the app and get an error that the column “phone” does not exist. A colleague added a migration yesterday that you haven’t applied yet. Running the migrate command, for example prisma migrate dev or a Flyway migrate, brings your local database up to date.
Our own explanation, not a quote from the book.
In the book
Sentences from The Software Realm, Decoded that mention Database Migrations, exactly as printed.
3 more passages about Database Migrations in the full book
Read every conversation where Database Migrations comes up, with the interactive slides and demos.
Where it fits
Controlled schema changes across teams and production
Coverage in the book
Explained and compared with alternatives, so you know where and why it’s used.