From 52bd5ed27c64446ae2c4902f842f6ef63b572069 Mon Sep 17 00:00:00 2001
From: Olaoluwa Oluro <olaoluro@gitlab.com>
Date: Tue, 29 Oct 2024 11:41:36 +0000
Subject: [PATCH] Add desired sharding key for
 protected_branch_merge_access_levels

---
 .../protected_branch_merge_access_levels.yml  | 20 ++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/db/docs/protected_branch_merge_access_levels.yml b/db/docs/protected_branch_merge_access_levels.yml
index a16ddd6aba02..2ab9e7793497 100644
--- a/db/docs/protected_branch_merge_access_levels.yml
+++ b/db/docs/protected_branch_merge_access_levels.yml
@@ -8,4 +8,22 @@ description: Stores merge access settings for protected branches
 introduced_by_url: https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/5081
 milestone: '8.11'
 gitlab_schema: gitlab_main_cell
-sharding_key_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/490485
+allow_cross_foreign_keys:
+- gitlab_main_clusterwide
+desired_sharding_key:
+  protected_branch_project_id:
+    references: projects
+    backfill_via:
+      parent:
+        foreign_key: protected_branch_id
+        table: protected_branches
+        sharding_key: project_id
+        belongs_to: protected_branch
+  protected_branch_namespace_id:
+    references: namespaces
+    backfill_via:
+      parent:
+        foreign_key: protected_branch_id
+        table: protected_branches
+        sharding_key: namespace_id
+        belongs_to: protected_branch
-- 
GitLab