The migration was supposed to be simple. Add a new column. Push to production. Go home.
But a new column is never just a new column. It is schema changes, data integrity, nullability, indexing, and backwards compatibility. It is codebase edits in models, serializers, queries, tests. It is database locks that can block writes if done wrong.
Adding a new column in SQL starts with precision. Choose the right data type. Define constraints early or pay for them later. Decide if it should allow NULLs, or set a default. Use ALTER TABLE with care—on large tables, even adding a simple VARCHAR can stall operations. In PostgreSQL, avoid a full table rewrite unless absolutely necessary. In MySQL, watch out for storage engine behavior.
Plan for zero downtime migrations. If the data is large, consider adding the column as nullable, backfilling data in small batches, then making it NOT NULL in a separate migration. Use feature flags to control the release. Deploy code that can handle both the old and the new schema until the cutover is complete.