Adding a new column sounds simple. In practice, it can break deployments, stall migrations, and lock tables under load. Whether you work with PostgreSQL, MySQL, or another relational database, creating a column in a live system requires care.
A new column definition must be explicit. Choose the data type with current and future usage in mind. Decide whether it’s nullable. If it needs a default value, understand the performance impact—on some engines, adding a default to millions of rows updates every record before returning control.
Run schema changes with zero downtime patterns. In PostgreSQL, ALTER TABLE ... ADD COLUMN is usually fast, but adding constraints or defaults can create writes to the full table. Split steps: first add the column without defaults or constraints, then backfill in batches, and finally add constraints in a follow-up migration. This avoids long locks and keeps the service responsive under heavy load.