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

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

class BackfillHashedProjectRepositories < ActiveRecord::Migration[4.2]
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false
  BATCH_SIZE     = 1_000
  DELAY_INTERVAL = 5.minutes
  MIGRATION      = 'BackfillHashedProjectRepositories'

  disable_ddl_transaction!

  class Project < ActiveRecord::Base
    include EachBatch

    self.table_name = 'projects'
  end

  def up
    queue_background_migration_jobs_by_range_at_intervals(Project, MIGRATION, DELAY_INTERVAL)
  end

  def down
    # no-op: since there could have been existing rows before the migration do not remove anything
  end
end