Add post migration to set value of occupies_seat column
What does this MR do and why?
- Follows up from !143911 (merged)
- It introduces a post migration which set
member_roles.occupies_seat = true
if the member role has a base-role which is guest+ or it has any of the guest+ permissions set. The permissions can be found inee/config/custom_abilities
and all permissions that don't have skip_seat_consumption = true are considered guest+
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.
Database
- The member roles table has a small number of rows, <1K.
- Query plan for update
Steps to reproduce
- Create the follow member roles in the rails console:
MemberRole.create(name: "Guest role", base_access_level: 10, read_code: true, namespace_id: nil)
=> occupies_seat = false
MemberRole.create(name: "Reporter role", base_access_level: 20, read_code: true, namespace_id: nil)
=> occupies_seat = true
MemberRole.create(name: "Guest+ role", base_access_level: 10, admin_terraform_state: true, namespace_id: nil)
=> occupies_seat = true
Related to #437719 (closed)
Edited by Hinam Mehra