The migration finished at 02:14, but the numbers didn’t line up. A field was missing. You need a new column, and you need it now.
Adding a new column in a production database is not just a schema tweak. It is a live change to the structure of your data, with direct impact on application behavior and query performance. Done right, it is safe, fast, and invisible to users. Done wrong, it breaks production.
Start by identifying the exact data type and nullability for the new column. Define defaults where needed to avoid breaking existing inserts. In transactional databases like PostgreSQL or MySQL, ALTER TABLE ... ADD COLUMN is the direct SQL statement. In PostgreSQL, adding a column with a default that is not NULL can lock the table; in MySQL, column addition may rebuild the entire table. On large tables, these details matter.
Plan for backfilling data. Do not block the main thread of your application with large updates. Use batched writes or background workers to populate the new column over time. Monitor load and watch replication lag if the database runs replicas.