The query ran fast, but the schema was behind. You need a new column, and you need it without breaking production.
A new column in a database table is not just metadata. It changes the shape of your data model, your queries, your indexes, your migrations. If you handle it wrong, it will lock tables, spike CPU, or corrupt data. If you handle it right, it’s just another deploy.
Start with the definition. Decide type, nullability, and default. Every choice here affects performance and storage. On large tables, adding a non-null column with a default can rewrite the entire table. Avoid that unless necessary—use NULL, backfill in batches, then add constraints.
Apply the migration as code. Version control it. A ALTER TABLE ADD COLUMN statement should be explicit in name, type, and constraints. Do it in a transaction if your database supports transactional DDL. Split schema changes from code changes so you can roll back independently.