The database was choking on old schema. You needed a new column, and you needed it fast.
Adding a new column in production can feel simple in code but dangerous in practice. A single ALTER TABLE on a large dataset can lock writes, stall queries, and trigger downtime. The right approach depends on table size, workload, and database engine.
In PostgreSQL, adding a column with a default value recalculates existing rows and can take minutes or hours on large tables. Without defaults, the operation is almost instant. MySQL behaves differently; some changes are online, others require a full table rebuild. Always test on a copy of production data to measure the performance impact before running live.
For high-traffic systems, use online schema migration tools like pg_online_schema_change, gh-ost, or pt-online-schema-change. These create the new column in a shadow table, sync changes, and swap structures with minimal lock time. This approach reduces risk and keeps uptime intact while the migration runs.