The migration froze halfway. A single missing command stopped the release, and the problem was simple: you needed a new column.
Adding a new column in a production database is never trivial. It changes the schema, impacts queries, and can trigger unexpected lock times. The goal is to design, deploy, and integrate it without breaking application performance or blocking writes.
Start by defining the schema change clearly. Choose a column name that matches existing conventions. Specify the data type exactly—avoid implicit casts or overly generic types. Consider whether the column should allow NULL values or require a default. For high-traffic systems, always prefer ADD COLUMN ... NULL first, then backfill in batches before setting NOT NULL constraints.
Use transactional DDL only if your database can handle it without long locks. In PostgreSQL, adding a NULLable column without a default is fast, but adding a column with a default before version 11 rewrites the entire table. On MySQL, ALTER TABLE locks writes unless you use ALGORITHM=INPLACE where supported. Always read the execution plan of your migration engine or tool.