The migration script had one job: add a new column. Yet every engineer knows the moment you touch a schema, the ripple can break systems you forgot existed.
A new column sounds simple. Define it, choose a type, set constraints, and run the migration. But adding it to a live production database means thinking through locking, defaults, nullability, and index strategies before a single command is executed. Without that, you risk downtime or silent data corruption.
Start with the schema definition. Make the column explicit: pick data types that align with existing patterns and consider how they will be serialized in application code. Enforce constraints at the database level—NOT NULL with safe defaults when possible—to prevent bad data from ever landing.
Run migrations with precision. Large tables require operations that minimize locks. Use ADD COLUMN with default values applied in separate steps to avoid full-table rewrites. For distributed environments, write migrations that can run incrementally and verify schema changes at each stage.