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

20171205190711_reschedule_fork_network_creation_caller.rb « post_migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 30ff5173192228054e50984f1b850750a5633c5c (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
class RescheduleForkNetworkCreationCaller < ActiveRecord::Migration
  include Gitlab::Database::MigrationHelpers

  DOWNTIME = false

  MIGRATION = 'PopulateForkNetworksRange'.freeze
  BATCH_SIZE = 100
  DELAY_INTERVAL = 15.seconds

  disable_ddl_transaction!

  class ForkedProjectLink < ActiveRecord::Base
    include EachBatch

    self.table_name = 'forked_project_links'
  end

  def up
    say 'Populating the `fork_networks` based on existing `forked_project_links`'

    queue_background_migration_jobs_by_range_at_intervals(ForkedProjectLink, MIGRATION, DELAY_INTERVAL, batch_size: BATCH_SIZE)
  end

  def down
    # nothing
  end
end