Skip to content

Follow up for `gitlab:db:lock_writes`, make it run after each DB Migration

Original Idea

To make sure that gitlab_ci tables remain write-protected on the Main Database, and gitlab_main tables remain write-protected on the CI Database after the decomposition project is finished, we need to

  1. Make sure that the rake task gitlab:db:lock_writes runs after each DDL database migration.

  2. Since this task will keep running during normal user traffic, and because CREATE TRIGGER requires EXCLUSIVE LOCK on the tables, we need to modify the task to create the trigger on the tables only in case it didn't exist before.

More context for: !83211 (comment 947715319)

New idea

The idea of locking the writes on the new tables has evolved since we wrote this ticket, and we are doing it in a new approach explained in this MR: !99287 (merged)

Edited by Omar Qunsul