Backend development

Stage 2 · Lesson 10 of 11

Schema migrations

Relational databases and SQL

Without an , you manage changes with a dedicated tool such as golang-migrate, goose or Atlas. Each is a numbered SQL file, often with an up part and a down part to undo it. You commit it next to the code that needs it.

The tool records which migrations have run in each database, so every environment reaches the same schema. can read the same migration files to learn your tables. Run migrations as a separate deploy step rather than at every app start, so several copies of the app do not race each other. Never edit a migration that has already run elsewhere.

Common trapa in one step, such as renaming a column the running code still reads. Instead, add the new column, copy the data, switch the code, then drop the old one.

A question to check yourself, an AI practice session and 1 cheat sheet entry come with the full roadmap. Unlock

Resources for this stage

Start with· follow one of these

Practise

Also worth your time

Mark this stage as not done?