The schema was locked. The deploy was minutes away. A new column had to be added, and there was no room for error.
Adding a new column is simple in theory: define it, set the type, apply defaults, and backfill if needed. In production, it’s a high‑risk change that can break queries, slow reads, and lock tables. Precision matters.
Start by defining the column in your migration file. Use explicit types, not implicit defaults. Avoid NULL unless you have a clear reason to allow it. For large datasets, backfill in batches to reduce write locks. Always index only after data is populated to avoid slowdowns.
Check dependencies. Stored procedures, triggers, and ETL pipelines often assume the old schema. Health‑check every consumer of the table before running the migration. Test the new column in staging with production‑like data. Measure query performance before and after.