Adding a new column is one of the most common schema changes. Done wrong, it locks tables, slows applications, and risks production outages. Done right, it’s seamless, safe, and fast. Whether you are using Postgres, MySQL, or another relational system, the principle is the same: control the migration, isolate the change, and protect your customers from disruption.
First, plan the new column. Define its name, data type, nullability, and default value. Avoid expensive defaults on large tables, as they can trigger a rewrite of the entire table. Instead, add the column without a default, then populate it in small batches with an UPDATE job.
Second, run the schema change through a migration tool that supports online changes. Tools like gh-ost for MySQL or pg_online_schema_change for Postgres can help avoid table locks. If your framework includes built-in migrations, verify how it handles large schema changes in production.