Create database table to track approved approvers for v2 approval rules

Table which stores mr approvers post-merge for compliance purposes.

Requirements:

Create merge_requests_approval_rules_approved_approvers table with:

  • Columns:
    • approval_rule_id (bigint, NOT NULL, composite PK)
    • user_id (bigint, NOT NULL, composite PK)
    • group_id (bigint, nullable)
    • project_id (bigint, nullable)
  • Composite primary key on (approval_rule_id, user_id)
  • Foreign keys:
    • approval_rule_id → merge_requests_approval_rules.id (cascade on delete)
    • user_id → users.id (cascade on delete)
  • Indexes on sharding keys (group_id, project_id)
  • Sharding key validation/exemptions

NB, validate these requirements during implementation and adjust as needed.

Reference: POC implementation in poc/v2-approval-rules-complete branch

Edited Feb 12, 2026 by Gavin Hinfey
Assignee Loading
Time tracking Loading