The database schema had to change before the next deploy. A new column was the simplest path. It was also the most dangerous.
Adding a new column is not just an ALTER statement. It touches every layer of your stack. Done wrong, it locks tables, triggers downtime, and breaks integrations. Done right, it ships without anyone noticing.
Start with the schema migration. In PostgreSQL, ALTER TABLE ADD COLUMN is fast for new nullable columns without defaults. For large datasets, adding a column with a default value rewrites the entire table—this can block reads and writes. In MySQL, zero-downtime migrations often require pt-online-schema-change or gh-ost to avoid table locks.
Define the column as nullable first. Populate it in small batches. Add indexes only after the backfill completes. This keeps load low and avoids triggering replication lag. If the column must be non-nullable, enforce that constraint after data is in place.