summaryrefslogtreecommitdiff
path: root/db/post_migrate/20200220115023_fix_projects_without_prometheus_service.rb
blob: 274a392a52a63d8e8284a4325cc76177d52d01f3 (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

# See http://doc.gitlab.com/ce/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.

class FixProjectsWithoutPrometheusService < ActiveRecord::Migration[6.0]
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false

  BATCH_SIZE = 50_000
  MIGRATION = 'FixProjectsWithoutPrometheusService'

  disable_ddl_transaction!

  class Project < ActiveRecord::Base
    include EachBatch
  end

  def up
    queue_background_migration_jobs_by_range_at_intervals(Project, MIGRATION, 2.minutes, batch_size: BATCH_SIZE)
  end

  def down
    # no-op
  end
end