summaryrefslogtreecommitdiff
path: root/db/post_migrate/20211110151350_schedule_drop_invalid_security_findings.rb
blob: 98e7b2a8a15a2e8bed981ddcb48d5ef1340e3ae0 (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
# frozen_string_literal: true

class ScheduleDropInvalidSecurityFindings < Gitlab::Database::Migration[1.0]
  disable_ddl_transaction!

  MIGRATION = "DropInvalidSecurityFindings"
  DELAY_INTERVAL = 2.minutes.to_i
  BATCH_SIZE = 100_000
  SUB_BATCH_SIZE = 10_000

  def up
    queue_background_migration_jobs_by_range_at_intervals(
      define_batchable_model('security_findings').where(uuid: nil),
      MIGRATION,
      DELAY_INTERVAL,
      batch_size: BATCH_SIZE,
      other_job_arguments: [SUB_BATCH_SIZE],
      track_jobs: true
    )
  end

  def down
    # no-op
  end
end