The query fired and the table returned nothing new. The missing detail was a column that didn’t exist yet. Adding it should have been simple. It wasn’t.
A new column in a database is more than an extra slot for data. It changes the shape of every query. It updates the schema that defines how your application understands its state. Whether you work with PostgreSQL, MySQL, or SQLite, the process follows the same baseline: alter the table, define the data type, set default values if needed, and handle existing rows.
For relational databases, the SQL command is direct:
ALTER TABLE users ADD COLUMN last_login TIMESTAMP;
This works if downtime is fine. On production systems, adding a new column can lock the table. That means blocked writes and read slowdowns. Use tools like gh-ost, pg_online_schema_change, or native features in newer engines for online schema changes.
Indexing the new column is a separate concern. Adding an index at creation time can speed lookups but increase write costs. Decide based on query patterns, not habit.