The root cause was a missing new column in the database schema.
Adding a new column is simple in principle but often the most overlooked step in database evolution. It shapes how your application stores, queries, and scales data. Done right, it’s seamless. Done wrong, it can break services in production.
Start by defining the column name, type, and constraints. Choose the smallest possible data type that satisfies the requirements—smaller columns mean faster queries and less storage. Decide if the new column allows nulls, has a default value, or needs an index. These choices affect query plans and migration speed.
For SQL:
ALTER TABLE users ADD COLUMN last_login TIMESTAMP DEFAULT CURRENT_TIMESTAMP;
In PostgreSQL, this is transactional and fast for additive changes. In MySQL, adding a new column can lock the table depending on engine and version. On large datasets, use tools like gh-ost or pt-online-schema-change to avoid downtime.