Adding a new column in a production database is simple in syntax but complex in impact. Schema changes can lock tables, slow queries, and block deploys. A careless ALTER TABLE can cause downtime. The key is to design the new column with zero disruption.
First, define the column in a way that matches future data needs. Choose the right type, size, and default. Avoid expensive defaults that rewrite the entire table. If you need default values, use a nullable column and backfill in small batches. This keeps production viable.
Second, apply the change in a controlled migration. Use tools that support online schema changes to prevent locks. In MySQL, consider pt-online-schema-change or gh-ost. In Postgres, adding a nullable column without a default is instant, but adding a default on a large table is not. Test this on a staging environment with production-like data before pushing live.