The migration failed. A missing new column broke the build and blocked the deploy. Everyone stopped what they were doing.
Adding a new column to a database table should be simple. It isn’t. The wrong approach can cause downtime, data loss, and broken applications. The right approach makes the change seamless and safe.
First, define the new column with the correct type and constraints. Avoid defaults that lock the table during creation. For large tables, add the column as nullable, backfill in small batches, then apply NOT NULL constraints in a second migration. This prevents long-running locks that block writes and reads.
Coordinate schema changes with application code updates. Deploy code that can handle both the old and new states. If the column will be used for writes, ensure the data path is ready before you start backfilling. Use feature flags to control rollout without redeploying.