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

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

class ScheduleRemoveSelfManagedWikiNotes < Gitlab::Database::Migration[2.0]
  restrict_gitlab_migration gitlab_schema: :gitlab_main

  MIGRATION = 'RemoveSelfManagedWikiNotes'
  INTERVAL = 2.minutes

  disable_ddl_transaction!

  def up
    return if skip_migration?

    queue_batched_background_migration(
      MIGRATION,
      :notes,
      :id,
      job_interval: INTERVAL,
      batch_size: 10_000,
      sub_batch_size: 1_000
    )
  end

  def down
    return if skip_migration?

    delete_batched_background_migration(MIGRATION, :notes, :id, [])
  end

  private

  def skip_migration?
    Gitlab.staging? || Gitlab.com?
  end
end