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

20210811214811_schedule_copy_ci_builds_columns_to_security_scans.rb « post_migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: dc90c202c410af18cbb44671794494f311afdaff (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
30
31
32
33
# frozen_string_literal: true

class ScheduleCopyCiBuildsColumnsToSecurityScans < ActiveRecord::Migration[6.1]
  include Gitlab::Database::MigrationHelpers

  INTERVAL = 2.minutes.to_i
  BATCH_SIZE = 5_000
  MIGRATION = 'CopyCiBuildsColumnsToSecurityScans'

  disable_ddl_transaction!

  class SecurityScan < ActiveRecord::Base
    include EachBatch

    self.table_name = 'security_scans'
  end

  def up
    SecurityScan.reset_column_information

    queue_background_migration_jobs_by_range_at_intervals(
      SecurityScan,
      MIGRATION,
      INTERVAL,
      batch_size: BATCH_SIZE,
      track_jobs: true
    )
  end

  def down
    # noop
  end
end