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

update_users_set_external_if_service_account.rb « background_migration « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c8f1847aca3366af47f2ae12cc913615221f157d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# frozen_string_literal: true

module Gitlab
  module BackgroundMigration
    # This class is responsible for updating users external field if service account.
    class UpdateUsersSetExternalIfServiceAccount < BatchedMigrationJob
      operation_name :update # This is used as the key on collecting metrics
      scope_to ->(relation) { relation.where(user_type: HasUserType::USER_TYPES[:service_account]) }
      feature_category :system_access

      def perform
        each_sub_batch do |sub_batch|
          sub_batch.update_all(external: true)
        end
      end
    end
  end
end