A new column was the only fix. It needed to be created, populated, and deployed without breaking production. Databases do not forgive half-measures. Every migration leaves a trail. If you add a column, you must control its type, default values, nullability, and indexing.
In PostgreSQL, adding a new column is simple:
ALTER TABLE orders ADD COLUMN status TEXT NOT NULL DEFAULT 'pending';
But simplicity hides traps. Large tables can lock during schema changes, blocking writes. On high-traffic systems, even a fraction of downtime means lost revenue. Use transactional schema changes where possible, and test them with data sets matching production scale.
For MySQL, column order can matter for certain storage engines. Use AFTER only when you have strict ordering requirements. Otherwise, append columns to avoid rewriting the entire table.
When adding a new column to track computed or indexed data, think ahead. Will it require a unique constraint? Will queries need the new column in a composite index? Index creation is a separate operation—plan it after column creation to reduce lock contention.