The migration deployed without errors, but the data was wrong. The root cause: a single new column added in the wrong place.
Adding a new column sounds simple. It is not. In production systems, the small change can break queries, trigger unexpected nulls, or corrupt reports. Schema changes ripple through backends, APIs, and analytics pipelines. The safest path requires precision, zero-downtime strategies, and clear rollback plans.
Before adding a new column in SQL, start with a schema review. Check every query, stored procedure, and ORM mapping that touches the table. For large datasets, adding a column with a default value can lock writes for seconds or minutes. Use NULL initially, then backfill in small batches. Apply an index only after the data is populated to avoid blocking.
In PostgreSQL, ALTER TABLE ... ADD COLUMN is fast without defaults, but slow with them. MySQL behaves differently depending on the engine and version. Document these behaviors. Test them against production-sized datasets before running them live.