The migration crashed halfway. The logs showed one culprit: a missing new column.
Adding a new column sounds simple. In practice, it can break production, lock tables, or trigger cascading issues in dependent services. Every database, from PostgreSQL to MySQL to SQLite, handles it differently. A careless ALTER TABLE can cause downtime if it locks rows under heavy load.
A safe new column deployment starts with knowing your schema and how the database executes changes. Online schema changes, batched migrations, or feature-flagged rollouts can prevent blocking writes. Use tools like pg_repack, gh-ost, or native online DDL to add columns without locking. Always test migrations in a staging environment with production-like volume before pushing live.
When adding a new column with defaults, beware of backfilling large datasets during the change. For massive tables, separate the schema alter from the data update. Add the column as nullable, then backfill in small batches. Once complete, apply the constraint in a follow-up migration. This reduces risk and keeps latency stable.