Adding a new column in a production database sounds simple. It is not. Schema changes can lock tables, block writes, and stall critical processes. Downtime is expensive, and migrations can spiral if not planned with precision.
A new column changes the shape of your data. Even one field can break code paths, trigger null constraint errors, or slow queries if defaults rebuild tables. To add a column without creating chaos, you need a strategy.
First, inspect your database size and index usage. On small tables, an ALTER TABLE ... ADD COLUMN might finish in milliseconds. On large, high-traffic tables, it can take minutes or hours. In PostgreSQL, adding a nullable column with no default is instant. Adding a default rewrites the table. Know which case you have before running the command.
Second, deploy in phases. Ship code that can handle both old and new schemas. Add the column, allow writes to it in a controlled rollout, then make the feature depend on it when confirmed stable. Finally, backfill data in batches to avoid write spikes.