Adding a new column is more than altering a schema. It is a change in the contract between your application and your database. Done wrong, it can lock tables, break queries, or corrupt data in production. Done right, it should be atomic, safe, and easy to roll back.
First, define the column name and type with precision. Mismatched data types cause silent failures. Use explicit types over defaults to avoid downstream parsing issues.
Second, plan the migration. Schema changes in large tables can block writes for minutes or hours. Avoid downtime by using tools that run online migrations, or by creating the column as nullable, backfilling data in batches, and only then applying constraints.
Third, update your application code. Read paths must handle the absence of data during backfills. Write paths must fill new columns immediately once constraints are enforced. Version control your schema changes alongside your application code to keep deployments in sync.