blob: fdceb2f2594b8611384594b982c62b15e360410b (
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
|
# frozen_string_literal: true
class SchedulePurgingStaleSecurityScans < Gitlab::Database::Migration[2.0]
MIGRATION = 'PurgeStaleSecurityScans'
BATCH_SIZE = 10_000
DELAY_INTERVAL = 2.minutes
restrict_gitlab_migration gitlab_schema: :gitlab_main
disable_ddl_transaction!
def up
return unless should_run?
queue_background_migration_jobs_by_range_at_intervals(
Gitlab::BackgroundMigration::PurgeStaleSecurityScans::SecurityScan.to_purge,
MIGRATION,
DELAY_INTERVAL,
batch_size: BATCH_SIZE,
track_jobs: true
)
end
def down
# no-op
end
private
def should_run?
Gitlab.dev_or_test_env? || Gitlab.com?
end
end
|