Change the schema without losing data
The change you can't casually undo.
I need to change my schema: <describe — new column, renamed column, split table, changed type> Current schema: <paste>. Rows: roughly <n>. Downtime acceptable: <yes / no>. Write the migration: - Forward steps, in order, each one safe to run on live data. - Whether this needs to be done in phases so old and new code can both run during the deploy. If so, spell out the phases. - The rollback, and be honest if there isn't one. - What happens to existing rows — defaults, backfill, null handling. - How long it will lock the table, roughly, at my size. Then: what do I check afterwards to confirm nothing was lost?
Ask about locking. A migration that takes a table offline for four minutes is fine at 3am and an incident at lunchtime.