Adding a new column in a database should be simple. In reality, the impact is often systemic. The column must be defined with the correct data type, nullability, and default values. Any mistake becomes technical debt that spreads fast.
Start in the migration script. In PostgreSQL, ALTER TABLE table_name ADD COLUMN column_name data_type is the basic command. Add constraints directly if possible. For large datasets, consider ADD COLUMN ... DEFAULT with caution. This can lock the table. Instead, add the column without a default, backfill in batches, then set the default and constraint.
The ORM layer needs updating next. Map the new column in your model definitions so the application can read and write to it. Changes here should be version-controlled and shipped alongside the migration to avoid null or missing data errors in production.
APIs that expose or accept the new column must change in sync. Document these changes, update contracts, and, where possible, make them backward-compatible. Tests should cover query and mutation paths involving the new field.