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

20211004110927_schedule_fix_first_mentioned_in_commit_at_job.rb « post_migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c7612db3aafc46a14dba84dec64b3a81ac91661f (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
27
# frozen_string_literal: true

class ScheduleFixFirstMentionedInCommitAtJob < Gitlab::Database::Migration[1.0]
  MIGRATION = 'FixFirstMentionedInCommitAt'
  BATCH_SIZE = 10_000
  INTERVAL = 2.minutes.to_i

  disable_ddl_transaction!

  def up
    scope = define_batchable_model('issue_metrics')
      .where('EXTRACT(YEAR FROM first_mentioned_in_commit_at) > 2019')

    queue_background_migration_jobs_by_range_at_intervals(
      scope,
      MIGRATION,
      INTERVAL,
      batch_size: BATCH_SIZE,
      track_jobs: true,
      primary_column_name: :issue_id
    )
  end

  def down
    # noop
  end
end