blob: 09e28cbe01cb46963a6bb76c27c673a2979fc66e (
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
|
# frozen_string_literal: true
class SchedulePopulateNamespaceRootId < ActiveRecord::Migration[5.1]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
BATCH_SIZE = 10_000
MIGRATION = 'PopulateNamespaceRootIdColumn'
DELAY_INTERVAL = 10.minutes.to_i
disable_ddl_transaction!
class Namespace < ActiveRecord::Base
self.table_name = 'namespaces'
include EachBatch
end
def up
say 'Scheduling `PopulateNamespaceRootIdColumn` jobs'
# We currently have ~4_600_000 namespace records on GitLab.com
# This means, the migration will schedule ~460 jobs (10k each) within a 10 minutes gap.
# so this should take ~153 hours to complete (assuming 30k namespaces per hour)
queue_background_migration_jobs_by_range_at_intervals(
Namespace,
MIGRATION,
DELAY_INTERVAL,
batch_size: BATCH_SIZE
)
end
end
|