Adding a new column to a production database should be simple. It rarely is. Schema changes at scale must balance speed, safety, and rollback paths. The wrong default or constraint can lock tables, block writes, or trigger a cascade of errors.
Start by defining the new column directly in your schema migrations. Use ALTER TABLE statements that are compatible with your database engine’s online DDL features. In PostgreSQL, add nullable columns first, then backfill values, then add constraints. In MySQL, choose algorithms that prevent full table locks.
For high-traffic applications, break the change into steps. First, deploy code that can handle both the old and new schema. Then create the new column in a way that is fast and non-blocking. If the column must be non-nullable with a default, set the default in application logic while you backfill. After the backfill, enforce constraints in the database. This minimizes downtime and avoids contention.