The query hit the database, but the table wasn’t ready. A missing field. A missing shape. You need a new column.
Adding a new column is one of the most common schema changes, yet it still breaks systems when done poorly. Whether you use PostgreSQL, MySQL, or another relational database, the process is direct but demands precision. Columns hold data, but they also hold contracts with your application code, APIs, and downstream consumers.
The standard way is simple:
ALTER TABLE users ADD COLUMN last_login TIMESTAMP;
That works in development, but production demands more care. Large tables can lock during ALTER TABLE, freezing writes. To avoid downtime, plan the migration. In PostgreSQL, consider ALTER TABLE ... ADD COLUMN with a default of NULL first, then backfill values in batches. Once populated, add NOT NULL constraints or indexes in separate transactions.
Always check dependent queries. ORMs may generate unexpected SQL if the new column is nullable or has no default. Adjust views, stored procedures, and ETL jobs that depend on the table schema. If you use feature flags, deploy code that supports the new column before making the schema change live.