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

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

class ScheduleSetCorrectVulnerabilityState < Gitlab::Database::Migration[2.0]
  disable_ddl_transaction!
  restrict_gitlab_migration gitlab_schema: :gitlab_main

  MAX_BATCH_SIZE = 5_000
  JOB_INTERVAL = 2.minutes
  MIGRATION_NAME = 'SetCorrectVulnerabilityState'
  BATCH_CLASS_NAME = 'DismissedVulnerabilitiesStrategy'
  SUB_BATCH_SIZE = 100

  def up
    queue_batched_background_migration(
      MIGRATION_NAME,
      :vulnerabilities,
      :id,
      job_interval: JOB_INTERVAL,
      batch_size: MAX_BATCH_SIZE,
      max_batch_size: MAX_BATCH_SIZE,
      batch_class_name: BATCH_CLASS_NAME,
      sub_batch_size: SUB_BATCH_SIZE
    )
  end

  def down
    delete_batched_background_migration(MIGRATION_NAME, :vulnerabilities, :id, [])
  end
end