The migration was under way, and the schema needed a new column. No delays, no excuses. Data had to move, features had to ship, and the database needed to evolve without breaking the system mid-flight.
Adding a new column sounds simple. It isn’t, not when your application is live and traffic is constant. A careless ALTER TABLE can lock writes, tank performance, or trigger costly downtime. The right approach reduces risk and keeps the release pipeline moving.
First, decide on the column definition. Choose the data type, nullability, and default value with precision. Avoid defaults that cause expensive table rewrites in production unless they are absolutely necessary.
Second, deploy the schema change in a safe, staged manner. For large tables, consider adding the new column as nullable, then backfilling data in small batches to avoid heavy locks. After the backfill completes, update the column constraints.