summaryrefslogtreecommitdiff
path: root/lib/gitlab/background_migration/reset_merge_status.rb
blob: d040b4931be3331927f608ab89e7e2aff64ceebd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# frozen_string_literal: true

module Gitlab
  module BackgroundMigration
    # Updates the range of given MRs to merge_status "unchecked", if they're opened
    # and mergeable.
    class ResetMergeStatus
      def perform(from_id, to_id)
        relation = MergeRequest.where(id: from_id..to_id,
                                      state_id: 1, # opened
                                      merge_status: 'can_be_merged')

        relation.update_all(merge_status: 'unchecked')
      end
    end
  end
end