The migration script was ready, but the table lacked one thing: a new column.
Adding a new column should be fast. It should be safe. It should not block your users or freeze your service. Yet in many workflows, this small schema change can trigger downtime, lock tables, or slow queries for hours. The right method depends on the size of your dataset, the database engine, and whether you can accept blocking operations.
In PostgreSQL, ALTER TABLE ADD COLUMN is simple and fast if you set a default of NULL. But if you add a column with a non-null default, it rewrites the whole table. On a large table, that will lock writes. MySQL with InnoDB supports instant column addition in some versions, but changing column order or defaults will often still require a rebuild. In distributed SQL systems, adding a new column may be cluster-wide and asynchronous, but schema propagation delays may affect queries until the change settles.
Safe rollouts for a new column often rely on a two-step release. First, add the column as nullable with no default, which is a metadata-only change in most engines. Then backfill data in small batches. Once the backfill is complete, add constraints and defaults in a second migration. This avoids long locks and keeps deployments smooth. Feature flags can hide unfinished columns from application code until the schema is stable.