summaryrefslogtreecommitdiff
path: root/db/post_migrate/20201110161542_cleanup_transfered_projects_shared_runners.rb
blob: 5e907092e83f9a2829d66cd409fd6bf67e622aa6 (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
# frozen_string_literal: true

class CleanupTransferedProjectsSharedRunners < ActiveRecord::Migration[6.0]
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false
  BATCH_SIZE = 25_000
  INTERVAL = 3.minutes
  MIGRATION = 'ResetSharedRunnersForTransferredProjects'

  disable_ddl_transaction!

  class Namespace < ActiveRecord::Base
    include EachBatch

    self.table_name = 'namespaces'
  end

  def up
    queue_background_migration_jobs_by_range_at_intervals(Namespace,
                                                          MIGRATION,
                                                          INTERVAL,
                                                          batch_size: BATCH_SIZE)
  end

  def down
    # This migration fixes an inconsistent database state resulting from https://gitlab.com/gitlab-org/gitlab/-/issues/271728
    # and as such does not require a down migration
  end
end