The schema was breaking. There was no more room for the data that mattered, so we built a new column.
Adding a new column is one of the most common changes in database evolution. Done wrong, it can trigger locking issues, slow migrations, and downtime. Done right, it’s fast, safe, and ready for production without breaking queries or indexes.
The process starts with defining the column name and data type in a migration file. This ensures schema drift is tracked and reproducible. For example, in PostgreSQL, use ALTER TABLE with ADD COLUMN to extend the table while keeping existing rows intact.
When adding a new column in a live system, check if it needs a default value or NOT NULL constraint. Defaults backfill data automatically, but in large tables, this can lock writes. To avoid blocking, add the column without defaults, then update rows in small batches. Finally, add constraints after the backfill completes.