The table is live. The query runs. But the data is wrong because the field you need does not exist. You need a new column.
Adding a new column should be simple. In practice, it can break production, lock tables, or leave code in a half-migrated state. The key is to design changes that are fast, safe, and easy to roll back.
First, choose the right data type. Changing it later is expensive. Match the column’s type and constraints to the data’s real requirements. Avoid overly generic types like TEXT when a fixed-length string or integer would be faster and more predictable.
Second, plan for deployment. Adding a new column can block writes on large tables. Use online schema changes when possible. In PostgreSQL, adding a nullable column without a default is instant. But adding a default with a non-null constraint rewrites the table. In MySQL, ALTER TABLE locks by default unless you use tools like pt-online-schema-change.