The migration broke at 2:13 a.m. because the schema no longer matched production. You were adding a new column.
Adding a new column sounds simple, but in production systems, it is one of the most common points of failure. The operation touches schema design, queries, indexes, and application logic. Every step must be correct to avoid downtime or data loss.
A new column changes how your database stores and returns data. First, define the column type with precision. Choose the smallest type that can hold the values you expect. Mismatched types lead to performance degradation or silent truncation.
Next, decide on nullability. Making a column NOT NULL without a default can break inserts immediately. If the application will write to the new column at creation time, enforce NOT NULL with a sensible default. If not, start as nullable, backfill in batches, and then add constraints.
Indexing is a separate consideration. Adding an index to a new column speeds up reads, but slows down writes. Build indexes in off-peak hours or use concurrent indexing tools where available. Evaluate whether the new column will often be part of WHERE or JOIN clauses before committing to additional indexes.