The migration finished, but the table was wrong. A critical field was missing. You need to add a new column now, without downtime, without breaking data integrity, and without blocking production queries.
Adding a new column sounds simple. In many databases, the wrong command can lock the table for minutes or hours. That means halted writes, stalled reads, and angry users. The right approach depends on the system, the schema size, and the query patterns.
In PostgreSQL, ALTER TABLE ADD COLUMN is fast for nullable columns with defaults defined as expressions. But older versions rewrite the table when adding a column with a fixed default, causing large I/O spikes. To avoid this, add the column as nullable, backfill in batches, then apply the default constraint. For MySQL, watch out for table rebuilds on InnoDB. With newer releases and ALGORITHM=INSTANT, certain column additions become metadata-only operations.
For distributed databases, like CockroachDB or Amazon Aurora, schema changes can be asynchronous. Monitor job progress and check for finalization before deploying code that expects the column to exist everywhere.