Adding a new column is simple in theory, but in production systems it can break queries, slow deployments, and introduce hidden bugs. The right approach depends on scale, database engine, and migration strategy.
First, decide what the new column will hold. Define its data type, default value, constraints, and nullability. Avoid nulls unless they are a clear and necessary signal. The column name should be short and descriptive. Future you will thank present you.
In relational databases like PostgreSQL, MySQL, or SQL Server, ALTER TABLE is the common path:
ALTER TABLE orders
ADD COLUMN status VARCHAR(20) NOT NULL DEFAULT 'pending';
On small datasets, this runs in seconds. On large tables, it can lock writes for too long. For high-traffic systems, consider online schema changes with tools like pt-online-schema-change, gh-ost, or native database features. These create the new column without blocking queries.