The code screamed for change. A single table, rigid and old, needed a new column.
Adding a new column is one of the most direct schema changes in a database, but it demands planning if you care about uptime, data integrity, and forward compatibility. Whether you use PostgreSQL, MySQL, or a columnar store, the process seems simple at first—extend the schema, update the application, deploy—but small mistakes here cascade fast.
Start with the migration script. In PostgreSQL, ALTER TABLE ADD COLUMN is straightforward, but the default behavior locks writes. On large tables, that can block your app. Use ADD COLUMN … DEFAULT … with care, because writing the default to every row can push I/O to the red. For hot paths, add the column without a default, then backfill in batches.
In MySQL, online DDL can mitigate downtime. Check if your storage engine is InnoDB and enable ALGORITHM=INPLACE where possible. Still, test the migration against a snapshot, not production. One missed constraint or type mismatch can break replication.