Adding a new column in a database sounds simple. In practice, it touches core workflow, schema design, and performance. Every change must fit the data model, integrate with queries, and avoid downtime.
Start with the schema migration. Use explicit types. Avoid NULL when it breaks logic. Plan the default values. In PostgreSQL, for example:
ALTER TABLE orders ADD COLUMN shipped_at TIMESTAMP WITHOUT TIME ZONE;
Adding a new column in production needs care. Run it inside a transaction when possible. For large tables, consider adding it without defaults, then backfilling in batches. This prevents locks that stall writes.
Update the application code immediately after the migration is live. Ensure SELECT statements include the new column where needed, and that INSERT operations supply valid data. Review stored procedures, triggers, and views.