2019-01-03 12:48:30 +05:30
|
|
|
class RescheduleForkNetworkCreationCaller < ActiveRecord::Migration
|
2018-03-17 18:26:18 +05:30
|
|
|
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
|