The migration failed at midnight because the schema didn’t match. A single missing new column brought the release to a stop.
Adding a new column sounds simple. It isn’t when production data is live, traffic is high, and every millisecond counts. The wrong approach can cause locked tables, errors in dependent services, or silent corruption in downstream systems.
The process starts with precise planning. Name the new column based on your schema conventions, define the correct data type, and set default values that won’t break existing code. Avoid adding NOT NULL constraints until after backfilling data. This prevents write operations from timing out during deployment.
In relational databases like PostgreSQL or MySQL, use migrations that separate schema changes from data backfills. First, add the new column as nullable. Then deploy the application code that supports reading and writing it. Only after the data is filled should you enforce constraints or create indexes. This sequence reduces blocking and keeps rolling deploys safe.