summaryrefslogtreecommitdiff
path: root/db/post_migrate/20220722145845_schedule_backfilling_the_namespace_id_for_vulnerability_reads.rb
blob: e2d1846f8f67e94aa8d456b9ee5a3bcb05e26493 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# frozen_string_literal: true

class ScheduleBackfillingTheNamespaceIdForVulnerabilityReads < Gitlab::Database::Migration[2.0]
  MIGRATION_NAME = 'BackfillNamespaceIdOfVulnerabilityReads'

  restrict_gitlab_migration gitlab_schema: :gitlab_main
  disable_ddl_transaction!

  def up
    queue_batched_background_migration(
      MIGRATION_NAME,
      :vulnerability_reads,
      :vulnerability_id,
      job_interval: 2.minutes,
      batch_size: 10_000,
      sub_batch_size: 200
    )
  end

  def down
    delete_batched_background_migration(MIGRATION_NAME, :vulnerability_reads, :vulnerability_id, [])
  end
end