summaryrefslogtreecommitdiff
path: root/lib/gitlab/background_migration/expire_o_auth_tokens.rb
blob: 20dacd642dee4e347b836d32a0301b529756e405 (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
    # Add expiry to all OAuth access tokens
    class ExpireOAuthTokens < ::Gitlab::BackgroundMigration::BatchedMigrationJob
      scope_to ->(relation) { relation.where(expires_in: nil) }
      operation_name :update_all
      feature_category :database

      def perform
        each_sub_batch do |sub_batch|
          sub_batch.update_all(expires_in: 2.hours)
        end
      end
    end
  end
end