A database migration is in progress, and the schema needs a new column before the next deploy. There is no time for mistakes.
Adding a new column sounds simple. In production, under load, it is not. Schema changes can lock tables, slow queries, or introduce data drift if not planned. A clean workflow matters.
Start by defining the new column with precision. Use the correct data type from the start to avoid costly casts later. Decide on NULL vs. NOT NULL early. If default values are required, ensure they do not trigger full-table rewrites unless absolutely necessary.
For large tables, consider adding the column without the default first, then backfilling in controlled batches. This minimizes downtime and avoids contention. Use transactional DDL cautiously if your database supports it, as its locking behavior can still block writes.