The migration failed before lunch. The query ran fine in staging, but production threw an error: unknown column. You open the schema diff and see the real problem. You need a new column, but you need it without downtime, without locking tables, and without breaking writes in flight.
Adding a new column sounds simple. In reality, it can be dangerous for performance and data integrity. The right approach depends on your database, your workload, and your tolerance for risk. For PostgreSQL, ALTER TABLE ... ADD COLUMN is fast for metadata-only columns with defaults set to NULL. For MySQL, certain column changes trigger a table rebuild that will block queries. On high-traffic systems, that is unacceptable.
The safest pattern is to add the column in a non-blocking way, backfill in small batches, then make the column required. In PostgreSQL, you create the column with no default, update rows in controlled batches, then add the NOT NULL constraint. In MySQL with large datasets, use online schema change tools like gh-ost or pt-online-schema-change to avoid downtime.