Adding a new column to a database should be simple. In practice, it can lock tables, slow queries, or cause downtime if you get it wrong. The operation touches schema, data, and application code. Done without care, it breaks production.
First, define the new column in your schema with the right data type and default. Avoid NULL defaults unless you need them. For large datasets, use an online schema change tool to prevent blocking writes. Test the migration on a staging database with realistic load before touching production.
Next, deploy code that can handle both the old schema and the new one. Feature-flag any logic that depends on the new column to keep backwards compatibility during rollout. Update write paths first so new data is stored in every row. Then backfill old rows in small batches. Monitor replication lag and query performance throughout the process.