The migration hit production like a hammer. The data schema was wrong. No one could query the table without a timeout. All it needed was one fix: a new column.
Adding a new column sounds simple. In low-traffic development builds, it is. In production, with millions of rows and active connections, it can be a risk to uptime and data integrity. The approach depends on your database engine, your deployment pipeline, and your tolerance for locks.
In PostgreSQL, ALTER TABLE ... ADD COLUMN is fast if you provide a default of NULL. But adding a column with a default value on a large table will rewrite all rows, locking the table for the duration. To avoid this, add the column as nullable, then backfill in small batches. After the backfill, set your NOT NULL constraint.
MySQL behaves differently. Adding a column can be an instant operation or require a full table rebuild, depending on the storage engine, column position, and MySQL version. Use pt-online-schema-change or native ONLINE DDL in newer versions to minimize lock time.