Adding a new column to a database table can change the meaning of your data in ways code alone cannot. It is structural, permanent until undone, and affects every query touching that table. Done well, it becomes part of the model. Done poorly, it breaks production.
Start by defining exactly what the new column represents. Name it with precision. Choose the correct data type—integer, text, timestamp, boolean—based on how the column will be used in joins, filters, and aggregations. Watch for type mismatches between schema and application code.
When modifying a live database, use a migration script that is atomic and reversible. In SQL, the syntax is straightforward:
ALTER TABLE users ADD COLUMN last_login TIMESTAMP;
Run this in a staging environment first. Measure the impact on queries. For large tables, adding a new column can lock writes. Plan for downtime or use a rolling schema change tool.