The table is already in production when the request comes in: add a new column. No downtime. No broken queries. No mistakes.
Adding a new column sounds simple, but in real systems it can be a high‑risk change. Schema modifications can lock tables. They can block writes. They can break dependent services if handled poorly. Doing it right means planning for both the database and the code that consumes it.
First, decide the purpose and data type of the new column. Keep it minimal. Every extra field carries future cost. Define constraints only when they’re required now—not “just in case.”
Next, run the schema change in a way that won’t halt traffic. Many SQL engines support online DDL. Use tools like gh-ost or pt-online-schema-change for MySQL, or ALTER TABLE ... ADD COLUMN with concurrent options in PostgreSQL. Test the operation on a staging copy of production data to measure lock times and performance impact.