The migration broke at 2:13 a.m. The logs showed a missing field. The fix was simple: add a new column. The hard part was making it clean, fast, and safe in production.
A new column is more than a schema change. It can block queries, lock tables, and slow writes. In systems with live traffic, a sloppy ALTER TABLE can cascade into downtime. The right approach depends on database type, table size, and replication setup.
For small tables, a direct schema change works. On large datasets, you need online migrations. PostgreSQL with ADD COLUMN is fast if it’s nullable without a default. MySQL may lock rows unless you use tools like pt-online-schema-change or run ALTER TABLE in a controlled maintenance window.