The migration failed before the deploy finished. The root cause was simple: a missing new column in the schema.
Adding a new column to a production database should be fast, safe, and predictable. In many systems, it becomes a bottleneck—locking tables, breaking queries, or causing downtime under load. Problems multiply when the schema change touches critical tables or when code assumes the column already exists in every environment.
Plan the new column introduction in stages. First, create the column with defaults that avoid locking large tables. Next, backfill data in batches to prevent performance degradation. Finally, release the code that reads and writes to it only after confirming the column exists everywhere.
In PostgreSQL, ALTER TABLE ADD COLUMN is usually instant for nullable columns without defaults. In MySQL, the performance differs by storage engine and version. For both, test the migration on production-like datasets to avoid surprises. Use feature flags or conditional logic to handle mixed environments while rolling out the schema change.