You needed a new column.
Adding a new column sounds simple. It can be—if you know the exact steps and their impact. In a production database, adding a new column is a schema change that touches migrations, indexes, queries, storage, and downstream systems. Every choice in this process affects performance, reliability, and maintainability.
First, define the column name and data type with precision. Use types that fit the size and constraints of your data. Avoid generic TEXT or oversized VARCHAR unless required. Next, decide if the column should allow NULL. For high-read workloads, setting a default value during creation prevents NULL checks from slowing queries.
Migrations must run with zero downtime when possible. In PostgreSQL, adding a column with a default value can lock the table. One strategy is to add it nullable, backfill in batches, then set the default. In MySQL, some versions still lock for schema changes—consider using ONLINE DDL or tools like pt-online-schema-change.