The migration was done, but the schema had a hole. A new column was needed.
Adding a new column should be simple, but in production databases, simplicity hides traps. Schema changes touch live data, indexes, and queries. Done poorly, they lock tables, block transactions, or break services. Done well, they expand your data model without downtime or data loss.
A new column changes the structure of a table. It can store new attributes, support a new feature, or replace legacy fields. In relational databases like PostgreSQL, MySQL, or SQL Server, the ALTER TABLE … ADD COLUMN statement defines the change. Each database engine handles it differently. Some can add a nullable column instantly; others rewrite the full table depending on data type, default values, or constraints.
To add a new column in PostgreSQL without locking writes, avoid adding it with a non-null default in one step. First, add the column as nullable. Then backfill data in small batches. Finally, set the column to NOT NULL and add the default. This sequence reduces contention and production risk.