Class: Gitlab::BackgroundMigration::UpdateExistingSubgroupToMatchVisibilityLevelOfParent
- Inherits:
-
Object
- Object
- Gitlab::BackgroundMigration::UpdateExistingSubgroupToMatchVisibilityLevelOfParent
- Defined in:
- lib/gitlab/background_migration/update_existing_subgroup_to_match_visibility_level_of_parent.rb
Overview
This background migration updates children of group to match visibility of a parent
Instance Method Summary collapse
Instance Method Details
#perform(parents_groups_ids, level) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/gitlab/background_migration/update_existing_subgroup_to_match_visibility_level_of_parent.rb', line 7 def perform(parents_groups_ids, level) groups_ids = Gitlab::ObjectHierarchy.new(Group.where(id: parents_groups_ids)) .base_and_descendants .where("visibility_level > ?", level) .select(:id) return if groups_ids.empty? Group .where(id: groups_ids) .update_all(visibility_level: level) end |