gitlab-org--gitlab-foss/lib/gitlab/background_migration/reset_merge_status.rb
Oswaldo Ferreira f3efec2029 Reset merge status from mergeable MRs
Adds migrations to reset the merge_status of opened,
mergeable MRs. That's required by
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/28513
so we're able to sync the status update along merge-ref,
without leaving MRs with a stale merge-ref.
2019-05-31 15:21:20 -03:00

17 lines
506 B
Ruby

# 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: 'opened',
merge_status: 'can_be_merged')
relation.update_all(merge_status: 'unchecked')
end
end
end
end