The database was fine until the spec changed, and you needed a new column.
Adding a new column sounds simple. It can be. But in production, simplicity is rare. A poorly planned migration can lock tables, block writes, or bring down services. The way you add a new column depends on scale, storage engine, and traffic patterns. In high-throughput systems, even milliseconds of downtime can cascade into outages.
Start by understanding your database’s native ALTER TABLE behavior. In MySQL with InnoDB, adding a nullable column with no default can be instant on newer versions. In PostgreSQL, adding a column with no default is fast, but adding one with a non-null default rewrites the table. That rewrite can be huge if you have billions of rows.
For zero-downtime schema changes, break the task into stages. First, create the new column with defaults only at the application layer, not in the database. Then backfill data in small batches or with background workers. Once backfill is complete and the column is populated, update application code to rely on it. Only then enforce constraints or defaults at the database level.