The migration failed before it started. A missing new column in the schema stopped the build dead. Hours of logs and alerts confirmed the problem: the structure your code relies on is incomplete.
Adding a new column seems simple. It is not. Every new column interacts with indexes, queries, constraints, and application logic. Done poorly, it locks tables, causes downtime, or corrupts data. Done well, it keeps the system online without losing a single request.
Plan the change. Start with a schema migration that adds the new column in a non-blocking way. In PostgreSQL, use ALTER TABLE ... ADD COLUMN with a default set in a later step. This avoids a full table rewrite. In MySQL, consider online DDL or tools like gh-ost for large tables.
Populate the new column in batches. Backfill scripts should run under controlled load to avoid saturating CPU and I/O. Monitor replication lag if you run replicas.
Keep deployments atomic. Deploy the schema change first, then update application code to use the new column. This reduces the risk of null reads or unexpected behavior. Apply constraints, indexes, and foreign keys in later migrations when the column is fully populated.