A single table schema failed because the new column was missing.
Adding a new column should be simple, but in production it can trigger downtime, data loss, and broken code paths. Whether you work with PostgreSQL, MySQL, or other relational databases, the pattern is the same: schema changes must be atomic, backwards-compatible, and tested against real workloads.
A new column starts with an ALTER TABLE statement. The safest approach is to add the column as nullable with a default value. This ensures existing inserts and updates continue without errors. Avoid adding non-null columns with no default in one step; large datasets will lock the table and impact performance.
For zero-downtime deployments, split the process into stages. First, introduce the new column as nullable. Second, backfill data in small batches to reduce lock contention. Third, update application code to read from the new column. Last, enforce constraints and indexes when the system is fully migrated.