The fix was simple: add a new column. But the cascade of impacts—migrations, code updates, deployment—was anything but simple.
Adding a new column should be a fast, controlled operation. In production, speed comes second to safety. A well-planned column addition keeps systems online, preserves data integrity, and avoids downtime.
Start by defining the column with the correct data type and constraints at creation. Null handling, defaults, and indexes are not afterthoughts—they belong in the first migration. Adding a new column without a default can leave existing rows incomplete, which can trigger application errors on read.
Run migrations in stages. First, add the column in a non-blocking way. Avoid locking large tables for extended periods. Use online schema changes if supported by your database. Next, backfill data in batches to keep write load steady. Then update application code to read from and write to the new column only after the data is stable.