Adding a new column seems simple. In code, it’s one line. In production, it can break systems, slow queries, and lock tables. Schema changes demand speed and safety.
Start with clear intent. Define the column’s name, type, and constraints. Choose nullable or non-null carefully. Nullable prevents immediate data backfills, but can hide missing values. Non-null enforces integrity, but requires default values or migrations.
Plan the migration path. For large datasets, avoid blocking writes. Use online schema change tools, staged deployments, or background workers to fill the column. Test against realistic load. Monitor performance during rollout.