Skip to content

Added member_role_id in MemberApproval and Member model

Context

  • Currently the logic to identify/control the Promotion Management flow for Ultimate SelfManaged Customers does not account for Custom Roles. It uses NewRole > GUEST to check if this Member Role change is a Billable Role Change.
  • For Ultimate Tier Customers, CustomRoles Guest+ Roles might still have the access_level of GUEST and be Billable.
  • We need to modify the logic to handle CustomRoles to ensure every NonBillable to Billable Role change is handled via the Promotion Management Flow.
  • This MR introduces custom_role in the Member Promotion Management control method.

The First MR moves the billable logic to a common basic changes in the Member model and Update Service. This MR is still in review.

What does this MR do and why?

The changes in this MR modifies the Validation logic to account for member_role_id and persists the same in DB when passed via the service.

  • Updates unique constraint to include member_role_id
  • Adds new unique index to account for member_role_id
  • Saves member_role_id to db when passed
  • Modifies specs

This MR is not to be merged before the First MR is merged. The diff in this MR is the diff between the this and the First MR.

Another third MR is upcoming which will relay member_role_id via the UpdateService to the model.

PS: This entire feature is still a WIP and isn't yet release to prod.

ref: https://gitlab.com/gitlab-org/gitlab/-/issues/443491

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

Database Query Plan

Since the table is empty on production as this feature is still WIP behind a FF:

Old: Screenshot_2024-04-12_at_1.26.32_PM

https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/27514/commands/85693

New: Screenshot_2024-04-12_at_1.26.00_PM

https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/27514/commands/85695

Edited by Suraj Tripathi

Merge request reports