Adding a column is simple, but in production systems, it’s a live grenade. One wrong move and migrations fail, queries break, or data goes missing. A new column isn’t just a field. It’s schema evolution, index strategy, and backward compatibility all colliding at once.
Plan before you run the migration.
Start with checking dependent services. Audit every query that touches the table. Look for hardcoded column lists. Search for SELECT * patterns that could cause unexpected behavior when the schema changes.
Choose the right data type.
The wrong type forces later conversions, slows queries, and bloats indexes. For fields with known ranges, use the smallest type possible. If nullable, decide default values early to avoid migrations that break under strict constraints.
Write safe migrations.
Split DDL changes from data updates. Run schema changes in transactions where supported. For large datasets, consider online migration tools that avoid locking the table. Always test on a clone of production scale data.