Class: Gitlab::BackgroundMigration::BackfillDraftStatusOnMergeRequests

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/background_migration/backfill_draft_status_on_merge_requests.rb

Overview

Backfill draft column on open merge requests based on regex parsing of

their titles.

Defined Under Namespace

Classes: MergeRequest

Instance Method Summary collapse

Instance Method Details

#perform(start_id, end_id) ⇒ Object


22
23
24
25
26
27
28
29
30
# File 'lib/gitlab/background_migration/backfill_draft_status_on_merge_requests.rb', line 22

def perform(start_id, end_id)
  eligible_mrs = MergeRequest.eligible.where(id: start_id..end_id).pluck(:id)

  eligible_mrs.each_slice(10) do |slice|
    MergeRequest.where(id: slice).update_all(draft: true)
  end

  mark_job_as_succeeded(start_id, end_id)
end