The migration hit at midnight. A single missing new column in the database schema stopped the deploy cold. It was planned, tested, reviewed—but the new column never made it to production. Now the service was failing in real time.
Adding a new column sounds simple. In practice, it can break queries, overload indexes, or lock tables. The wrong move during a live deployment can cause downtime, data loss, or missed SLA targets. Precision matters.
Start by defining the new column exactly. Choose the right data type. Set nullability and default values. If performance is a concern, avoid wide types unless required. When existing rows need to be backfilled, run the migration in stages to reduce locking.
For relational databases, test your migration with production-scale data. In PostgreSQL, adding a nullable column with no default is fast, but adding a non-null column with a default rewrites the table. In MySQL, certain ALTER TABLE operations still lock the entire table. Know the behavior of your database engine before running the change.