The query ran. The result returned. But one column was missing. You need a new column, and you need it without breaking the system.
Adding a new column to a table sounds simple, but in production, every schema change is a point of risk. The goal is zero downtime, zero data loss, and predictable behavior in code paths that depend on the schema. Whether you work in PostgreSQL, MySQL, or another RDBMS, the process comes down to planning, execution, and verification.
First, assess the table size and access patterns. A blocking ALTER TABLE can lock writes for minutes or hours on large datasets. For PostgreSQL, use ADD COLUMN with a DEFAULT NULL to avoid table rewrites during the initial migration. Apply defaults and constraints in separate, smaller steps to keep locks short. For MySQL with InnoDB, confirm if your version supports instant DDL for adding columns, and fall back to online schema change tools like pt-online-schema-change if needed.