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

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

class UpdateVulnerabilityOccurrencesLocation < Gitlab::Database::Migration[1.0]
  BATCH_SIZE = 20_000
  DELAY_INTERVAL = 3.minutes
  MIGRATION_NAME = 'UpdateVulnerabilityOccurrencesLocation'

  disable_ddl_transaction!

  def up
    relation = Gitlab::BackgroundMigration::UpdateVulnerabilityOccurrencesLocation::Occurrence.where(location: nil)
    queue_background_migration_jobs_by_range_at_intervals(relation,
                                                          MIGRATION_NAME,
                                                          DELAY_INTERVAL,
                                                          batch_size: BATCH_SIZE,
                                                          track_jobs: true)
  end

  def down
    # no-op
  end
end