34 lines
659 B
Ruby
34 lines
659 B
Ruby
|
# 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
|