The query finished running, but the output looked wrong. You check the schema. There’s a missing field. You need a new column.
Adding a new column seems simple, but it’s where small mistakes break production. The database has its own rules. Migrations have side effects. Code changes ripple across services. Getting it right means you respect the data model and the runtime.
First, decide on the column type. Match it to the exact shape and scale of the data. Use NOT NULL only if every existing and future row can have a value. If old rows need defaults, set them in the migration, not in a later patch.
Second, plan the migration for zero downtime. Locking tables in a live system will block writes and break user flows. For relational databases, use tools like pt-online-schema-change or native online DDL for MySQL, PostgreSQL, or similar. For distributed systems, roll out in stages—add the column, deploy code that can read and write it, backfill data, and only then enforce constraints.