The code stopped compiling at 2:17 a.m. The error was simple: the database schema was out of sync. It was time to add a new column.
Adding a new column should be precise and fast. Done well, it avoids downtime, race conditions, and broken builds. Done poorly, it can block deploys and corrupt data. The steps are not hard, but they demand discipline.
First, define the new column in your schema with exact types and constraints. Choose non-null only if you can populate every row, or provide a default value. Decide if the column belongs in the same table or if it should be normalized into a related table.
Second, plan the migration. In development, run it against a copy of production data. Check for locks, check for query performance hits, and check for rollbacks under load. Measure the impact on indexes.