The migration was done. Or so we thought. But one missing new column in the database was enough to halt the release.
Adding a new column sounds simple. It rarely is. Schema changes in production carry risk. Downtime, blocked writes, replication lag—these are the traps. A careless ALTER TABLE can lock rows for seconds or minutes, depending on size and load. That might be fine in staging. In production, it’s often a fire.
The safest approach is controlled, incremental change. Start by adding the new column as nullable with no default. Apply the migration in a low-traffic window, or use an online schema change tool. Avoid running blocking operations during peak. Once deployed, backfill in small batches to prevent replication backlog. Then add indexes if required. Only after the backfill is complete should you enforce constraints or set a default.
In versioned code, feature-flag the usage of the new column. Deploy the migration first, then ship code that writes to it, and finally code that reads from it. This keeps deployment reversible and avoids broken queries across versions.