Adding a new column should be simple. In practice, it’s where schema changes meet production risk. The wrong migration script can lock tables, block writes, or drop data. The right process ensures zero downtime, backward compatibility, and quick rollback if something fails.
First, define the new column in your schema migration tool of choice. Use explicit types and default values to avoid null issues. For large datasets, add the column as nullable and backfill asynchronously before enforcing constraints.
Second, deploy the migration separately from the application changes that depend on it. This prevents failures when code expects a column that doesn’t yet exist in some environments.
Third, monitor replication lag and query performance during the migration. A new column can change index usage or trigger full table rewrites.