The migration broke at 2:14 a.m. The deployment froze, the logs filled with silent failures, and the root cause was one missing new column in a production table.
Adding a new column should be simple. In practice, it touches every layer of your system. Schema migrations must run cleanly in staging and production. Code must handle both the presence and absence of the column during rollout. Queries must avoid locking large tables when the new column is added. Backfill jobs must run without starving the database.
Start with an explicit migration plan. Use tools like ALTER TABLE ADD COLUMN with safe defaults and null handling. Where supported, declare the column as nullable first, then apply constraints in a later deployment. This avoids downtime and makes rollback possible without heavy rewrites.
Tests must account for both old and new schema states. Feature flags can decouple schema changes from feature releases, ensuring that adding a new column does not depend on a single deploy window. Monitor query performance before and after the change to catch index needs early.