The deployment was live, but the schema was already out of sync. The fix was urgent: add a new column.
A new column changes the structure of a database table. It can store new data points, support new features, or replace brittle workarounds. The goal is precision—add the column without breaking queries, constraints, or application logic.
Before altering the schema, define exactly what the new column will store. Decide on the data type. Consider nullability, indexing, and default values. Avoid broad types that invite data corruption.
In SQL, the ALTER TABLE statement adds a new column:
ALTER TABLE orders
ADD COLUMN delivery_time TIMESTAMP;
When dealing with large datasets, adding a new column can lock the table. Plan for this. In PostgreSQL, adding a column with a default value rewrites the table. To avoid downtime, first add the column as NULL, then backfill in batches, and finally set the default and constraints.