Adding a new column to a production database is simple to describe and risky to execute. Done wrong, it can block writes, lock rows, and bring your application to a standstill. Done right, it’s invisible to the end user and fully reversible.
The first question is whether the schema change is essential. Columns add complexity. Every new column must have a clear purpose and a defined data type. Avoid default values unless they are guaranteed to be correct at scale.
Plan the migration. Know your database engine’s behavior. In PostgreSQL, adding a new nullable column without a default is fast. Adding with a default rewrites the table and can be costly. In MySQL, even a simple new column can lock the table. Use ALGORITHM=INPLACE when possible, but confirm support in your version.
For zero-downtime changes, break the operation into steps. Create the new column without a default. Backfill data in small batches, monitoring for load spikes. Once backfilled, add constraints or defaults in separate steps. Each operation should be safe to roll back.