The migration ran clean, but the table looked wrong. You needed one thing: a new column.
Adding a new column sounds simple. It isn’t, if you want zero downtime, data integrity, and a safe rollback path. The wrong ALTER command can lock writes, push latency through the ceiling, or corrupt rows when deployed at scale.
Start by examining the schema. Identify indexes, constraints, and triggers that might affect the change. If the new column has a default value, understand how your database engine applies it—some engines rewrite every row, others store metadata until the value changes. For large datasets, this detail matters.
Use online schema change tools where supported. In MySQL, pt-online-schema-change or gh-ost can add a column without blocking. In PostgreSQL, adding a nullable column is fast, but filling it with values requires a separate UPDATE strategy. Split the migration: first create the column, then backfill in controlled batches to avoid overwhelming I/O. Monitor query plans to ensure the new column doesn’t break caching or indexes.