The logs pointed to a missing column. We needed a new column, but in production, with zero downtime.
Adding a new column to a live database should be simple. Yet poor planning here breaks deployments and slows release velocity. The safest method is to treat schema changes as first-class code. Write them, test them, ship them with the same rigor as application logic.
A new column starts with clarity. Name it with precision. Use types that match both current and planned usage. Always consider nullability and default values before execution. Changing these after release causes friction and risk.
In relational databases like PostgreSQL or MySQL, adding a new column should be done in small, reversible steps. Add the column with safe defaults. Deploy. Backfill data in batches. Deploy again to enforce constraints or indexes. This avoids long lock times and production outages.