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

20211214012507_backfill_incident_issue_escalation_statuses.rb « post_migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7f0168be1a4435e23e1a6a8e450b85ac0fd13301 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# frozen_string_literal: true

class BackfillIncidentIssueEscalationStatuses < Gitlab::Database::Migration[1.0]
  MIGRATION = 'BackfillIncidentIssueEscalationStatuses'
  DELAY_INTERVAL = 2.minutes
  BATCH_SIZE = 20_000

  disable_ddl_transaction!

  class Issue < ActiveRecord::Base
    include EachBatch

    self.table_name = 'issues'
  end

  def up
    relation = Issue.all

    queue_background_migration_jobs_by_range_at_intervals(
      relation, MIGRATION, DELAY_INTERVAL, batch_size: BATCH_SIZE, track_jobs: true)
  end

  def down
    # no-op
  end
end