Adding a new column should be simple, but it can break production if done carelessly. Schema changes require precision. The new column must match data types, default values, and constraints. Every change touches indexes, foreign keys, and queries.
The safest way to add a new column is through a staged rollout. First, alter the schema in a backward-compatible way. In SQL, this often means:
ALTER TABLE orders ADD COLUMN processed_at TIMESTAMP NULL;
Then deploy code that writes to both the old and new column paths. Once the data is backfilled, update reads to use the new column. Finally, remove old fields in a separate release to avoid downtime.
For large datasets, use non-locking operations if available—ADD COLUMN on massive tables can block writes. Some databases require workarounds, like creating a new table with the column and migrating rows in batches. Always test migration scripts against a clone of production data.