Adding a new column is one of the most common database changes, yet it can break deployments and trigger downtime if handled poorly. Whether you work with PostgreSQL, MySQL, or a cloud-native database, the process follows the same principles: plan, execute, verify.
First, define the new column in your schema migration. Choose the correct data type from the start—migrating between types later often locks tables under load. Decide if the column should allow null values. For large datasets, avoid adding NOT NULL columns without defaults; it can rewrite the entire table.
Second, run the migration in a way that won't block writes. In PostgreSQL, use ALTER TABLE … ADD COLUMN for instant metadata-only additions when no defaults are set. In MySQL, check your version for support of instant ADD COLUMN operations. If defaults are required, consider phased rollouts: add the column nullable, backfill in batches, then enforce constraints.