The build broke the moment the migration hit production. A missing new column in the main table stopped every request cold. Nothing moved until the schema matched the code.
Adding a new column sounds simple. It’s not. The difference between a smooth deploy and a dead system comes down to how you define, create, and populate it.
When you add a new column in SQL, you change the shape of the data. An ALTER TABLE ... ADD COLUMN statement modifies the schema instantly in most development environments, but in large data sets, it can lock the table and block reads and writes. Production databases with high traffic demand a strategy that avoids downtime.
Start with a migration. Keep it backward-compatible. Create the new column with a default that doesn't block. In PostgreSQL, use ALTER TABLE table_name ADD COLUMN column_name data_type without a default if the table is large, then backfill the data in batches. Only after the backfill should you add constraints or defaults. This prevents table-wide locks.
In MySQL, adding a nullable new column is often instant with InnoDB, but adding a non-nullable column with a default will trigger a full table rewrite. Use nullable columns at first, populate them, then enforce NOT NULL.