The schema is clean. The query runs fast. But the next requirement hits like a hammer: you need a new column.
Adding a new column is not just a schema change. It is a decision that affects performance, compatibility, and deployment speed. Whether it’s a simple integer, a text field, or a JSON column, you must handle it with precision.
Plan the change.
Check your migration strategy. Decide if the new column needs a default value, nullability rules, or indexing. Defaults can slow down large table migrations. Not-null constraints can break deploys if existing rows don’t have values.
Run the migration safely.
Use tools that support transactional DDL when possible. On massive datasets, consider adding the column without defaults first, backfilling in batches, then adding constraints. This approach avoids locking the table for long periods.