Adding a new column sounds simple. It isn’t. Schema changes can lock tables, spike latency, and spill into downtime if done wrong. In production, a careless ALTER TABLE is a grenade. You need a plan that minimizes risk, preserves performance, and makes rollbacks painless.
First, choose the safest migration strategy for your database engine. In PostgreSQL, adding a nullable column without a default is fast. Adding a default or a non-null constraint can rewrite the table. In MySQL, large tables require an online schema change with tools like gh-ost or pt-online-schema-change to avoid blocking writes.
Second, ensure your application can read and write with the new column in place before backfilling. Deploy schema changes in phases: