The build broke. You scan the logs, trace the query, and there it is — a missing new column.
Adding a new column to a database table is simple in theory. In practice, it’s a migration that can stall deployments, break APIs, and trigger cascading failures if not done with precision. Schema evolution demands more than a quick ALTER TABLE. It needs planning, backward compatibility, and zero downtime strategies.
The first rule: never block reads or writes during the migration. On large tables, an ALTER can lock the table for seconds, minutes, or worse. Use online schema change tools or managed migration features that create the new column in-place without interrupting live traffic.
The second rule: default values matter. Avoid large-scale backfills in one transaction. Instead, deploy the new column as nullable, ship the code that writes to it, and backfill in controlled batches. This pattern prevents heavy locks and keeps CPU and I/O under control.