Adding a new column should be exact and predictable. In modern systems, it must be safe in production, support rolling deployments, and avoid locking large tables. The path starts with a clear schema change plan. Define the column with its correct data type, default, and nullability. Avoid setting expensive defaults on creation for large datasets—use a nullable field, backfill asynchronously, then enforce constraints in a separate step.
In PostgreSQL, adding a new column without a default is instant. Adding one with a constant default and NOT NULL is also fast in current versions due to metadata-only changes. But for MySQL, the process can lock the table depending on the storage engine and column type. Always confirm engine support for instant DDL before executing in production.
Version-controlled migrations keep changes traceable. Tools like Flyway or Liquibase ensure every environment stays in sync. For zero-downtime pipelines, wrap your ALTER TABLE in operational safety checks, often gated behind feature flags. Roll forward, not back.