The migration finished at midnight, but the schema was wrong. The logs told the truth: the app was failing because a new column was missing.
Adding a new column sounds simple. It isn’t. In production, it can be the fault line between stability and chaos. You have to think about data type, defaults, nullability, indexing, locking, replication lag, and how each change impacts active queries.
Plan the change. In PostgreSQL, ALTER TABLE ADD COLUMN is fast for metadata, but adding defaults or constraints can lock the table. In MySQL, a new column can trigger a heavy rebuild, depending on the storage engine. With large datasets, this becomes a high‑risk operation without phased deployment.
Use a safe rollout pattern. First, add the column as nullable with no default. Deploy the application code that can read and write to it while tolerating nulls. Backfill data in batches, then add constraints or defaults in a second migration. For critical systems, run this in maintenance windows or behind feature flags.