The database table was ready, but it was missing the one field that could make or break the feature. You need a new column.
Adding a new column is one of the most common schema changes, but it carries hidden costs. It can block writes, lock rows, and cause downtime if done blindly. The goal is to extend the data model without disrupting the system.
Start with the definition. In SQL, the syntax is direct:
ALTER TABLE users ADD COLUMN last_login TIMESTAMP;
This works for small tables. On large datasets, it can be dangerous. Some engines rewrite the whole table on ALTER. This means gigabytes moved, locks held, and queries stalled.
In PostgreSQL, adding a column with a default value can be instant if the default is NULL. Set the default in a later step to avoid table rewrites. In MySQL, ALTER TABLE is blocking unless you configure ALGORITHM=INPLACE or use tools like gh-ost. These details matter if production is live and latency budgets are tight.