Welcome to mirror list, hosted at ThFree Co, Russian Federation.

populate_operation_visibility_permissions_from_operations.rb « background_migration « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 3f04e04fc4d57346abed8aa3947e1e52a033c390 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# frozen_string_literal: true

module Gitlab
  module BackgroundMigration
    # Migrates the value operations_access_level to the new colums
    # monitor_access_level, deployments_access_level, infrastructure_access_level.
    # The operations_access_level setting is being split into three seperate toggles.
    class PopulateOperationVisibilityPermissionsFromOperations < BatchedMigrationJob
      def perform
        each_sub_batch(operation_name: :populate_operations_visibility) do |batch|
          batch.update_all('monitor_access_level=operations_access_level,' \
            'infrastructure_access_level=operations_access_level,' \
            ' feature_flags_access_level=operations_access_level,'\
            ' environments_access_level=operations_access_level')
        end
      end

      private

      def mark_job_as_succeeded(*arguments)
        Gitlab::Database::BackgroundMigrationJob.mark_all_as_succeeded(
          'PopulateOperationVisibilityPermissionsFromOperations',
          arguments
        )
      end
    end
  end
end