Adding a new column in a database sounds small, but it can break production if done carelessly. The schema change can lock tables, cause downtime, or lead to data loss. The wrong migration step can block queries for minutes or hours.
The work starts by defining the column’s purpose. Know the data type, default value, null constraints, and indexing strategy before touching the schema. Use lightweight migrations for low-traffic windows or online schema changes for high-traffic systems. PostgreSQL’s ADD COLUMN is fast for nullable fields without defaults, but adding a NOT NULL with a default rewrites the table. MySQL offers ALGORITHM=INPLACE for certain column changes, but some alterations still lock writes.
Plan the migration as code. Store it in version control. Test against production-like data to measure lock times. Monitor query performance after deployment. Never skip a rollback plan; a failed ALTER TABLE mid-deploy can leave the schema in an unusable state.