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

20230721095222_delete_orphans_scan_finding_license_scanning_approval_rules2.rb « post_migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: cc8c0affdead89a26a29d6f9c4901758ce32d018 (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
34
# frozen_string_literal: true

class DeleteOrphansScanFindingLicenseScanningApprovalRules2 < Gitlab::Database::Migration[2.1]
  restrict_gitlab_migration gitlab_schema: :gitlab_main

  MERGE_REQUEST_MIGRATION = 'DeleteOrphansApprovalMergeRequestRules2'
  PROJECT_MIGRATION = 'DeleteOrphansApprovalProjectRules2'
  INTERVAL = 2.minutes

  def up
    queue_batched_background_migration(
      PROJECT_MIGRATION,
      :approval_project_rules,
      :id,
      job_interval: INTERVAL,
      batch_size: 500,
      sub_batch_size: 100
    )

    queue_batched_background_migration(
      MERGE_REQUEST_MIGRATION,
      :approval_merge_request_rules,
      :id,
      job_interval: INTERVAL,
      batch_size: 2500,
      sub_batch_size: 500
    )
  end

  def down
    delete_batched_background_migration(PROJECT_MIGRATION, :approval_project_rules, :id, [])
    delete_batched_background_migration(MERGE_REQUEST_MIGRATION, :approval_merge_request_rules, :id, [])
  end
end