[Data migration] Multiple blocking merge request approval rules
Migration part for the issue #1979 (closed), to allow one MR to have multiple approval rules, each with different members/ approval required settings.
Migration !8497 (merged)
-
ApprovalMergeRequestRuleandApprovalProjectRulemodels are created - Those two rules model will ahve HABTM relationship to
UserandGroup. - Existing
ApproverandAppoverGroupmodels will be deprecated. - Similar to before, MR's
ApprovalRulewill override ProjectApprovalRule. -
approval_rules_approvalsare created, a HABTM table betweenapprovalsandapproval_merge_request_rules.
Data migration !8669 (merged)
- The old model
ApproverandAppoverGroupwill be migrated to the new models. - Projects will be migrated first, and its merge requests then migrated.
When MR without overriding
ApprovalRuleis merged, the project'sApprovalRulewill be copied over (MergeRequest#finalize_approvals).
- When
Approver/ApproverGroupis added/removed,ApprovalRulewill be synced accordingly.
How is data being persisted before/after merge
The way models are finalized after merge can vary a bit. To illustrate the 3 scenarios, let's assume when MR is still open, the yellow rows are present:
1. When MR rule override exists
The blue rows are created once the MR is merged, recording which user approved which rule.
2. Project rule without MR rule override
The blue rows are created once the MR is merged, which are copying the project level rules as MR rules, and then approved_approvers.
3. Project rule without MR rule override, with code owner
Code owner rule always exists at MR level:
Iteration Plan
-
Create new tables
Migrate old data to new tables
-
A data migration to run for each project -
A data migration to run for each merge request
Hooks to ensure data changes are reflected in new model
-
Add hooks for approver/approver_group changes -
Add hooks for merge request 'approvals required' changes -
Add hooks for project 'approvals required' changes -
Ensure merged merge request's approval related records are no longer changed.
Investigate how code owner data can be migrated
-
When merge request is created/updated, update code owner rule
Edited by Mark Chao


