The query ran. The data came back wrong. You needed a new column.
Adding a new column in a production database is not just an ALTER TABLE command. It is a change that can affect performance, indexing, and downstream systems. Whether you use PostgreSQL, MySQL, or another relational database, the process must be deliberate.
First, define the purpose of the new column. Decide the data type with precision. INTEGER, VARCHAR, TIMESTAMP — each choice affects storage and query behavior. Avoid generic types that mask intent.
Second, plan for deployment. On large tables, adding a column with a default value can lock writes. Use migration tools that support non-blocking schema changes. In PostgreSQL, ALTER TABLE ... ADD COLUMN without a default is fast; populate values in a separate step to prevent long locks.
Third, update the application code. Ensure ORM models, serializers, and APIs account for the new column. Run tests that verify both reads and writes.