doc/development/database/database_upgrade_ddl_lock.md
During major PostgreSQL upgrades on GitLab.com, DDL (Data Definition Language) changes are temporarily blocked to prevent conflicts with the upgrade process. GitLab.com uses logical replication for PostgreSQL upgrades, replicating data between different major versions to achieve zero-downtime upgrades. During the upgrade window, new DDL changes can break the replication.
Instead of using a hard Production Change Lock (PCL) that blocks all deployments, a targeted lock prevents only database schema changes from being merged.
This approach allows GitLab to continue releasing other changes while protecting the database upgrade process from breaking schema modifications.
The DDL lock is configured in config/database_upgrade_ddl_lock.yml and enforced by a
Danger check that runs in CI/CD pipelines. The configuration includes:
db/structure.sql are automatically blocked by Danger.When a lock is configured and active:
If your merge request contains DDL changes and is affected by an upgrade lock:
You can still merge your changes. The Danger check displays a warning message indicating:
Consider merging your changes before the lock begins, or plan to wait until after the lock expires.
You must wait until the lock expires. The Danger check fails with an error message.
After the lock ends: