The migration script finished, but the table looked wrong. The numbers were fine, the indexes intact. One thing was missing: the new column.
Adding a new column sounds simple, but in production it can break queries, lock tables, or slow deployments. In relational databases, every schema change has cost. The right approach depends on database type, data size, and uptime requirements. A careless ALTER TABLE ADD COLUMN can trigger a full table rewrite. On large datasets, this means long blocking operations and downtime.
In PostgreSQL, adding a nullable column without a default is fast. Adding one with a default rewrites every row. The safer method is to first add it nullable, then backfill in batches, then apply the default. MySQL and MariaDB can perform instant column additions on some storage engines, but not all. For high traffic systems, online schema changes using tools like gh-ost or pt-online-schema-change minimize disruption.