Adding a new column sounds simple, but it can wreck production if done wrong. Schema changes can lock tables, cause downtime, or break dependent services. The key is precision: choose the right migration method, keep changes atomic, and guard against data loss.
Start by defining the column with exact types and constraints. Avoid defaults that trigger full-table rewrites unless required. For large datasets, use online migration tools like gh-ost or pt-online-schema-change. These allow you to create a new column without blocking reads or writes.
If you must backfill data, break it into batches. Use versioned database code so application logic handles both old and new schemas during rollout. Test migrations in an environment that mirrors production scale. Ensure your rollback is real, not theoretical.