blob: 56211989b8e6ffd1dc9ae840ccee0eb0855ec18c (
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
33
34
35
|
# frozen_string_literal: true
class ScheduleRequirementsMigration < Gitlab::Database::Migration[1.0]
DOWNTIME = false
# 2021-10-05 requirements count: ~12500
#
# Using 30 as batch size and 120 seconds default interval will produce:
# ~420 jobs - taking ~14 hours to perform
BATCH_SIZE = 30
MIGRATION = 'MigrateRequirementsToWorkItems'
disable_ddl_transaction!
class Requirement < ActiveRecord::Base
include EachBatch
self.table_name = 'requirements'
end
def up
queue_background_migration_jobs_by_range_at_intervals(
Requirement.where(issue_id: nil),
MIGRATION,
2.minutes,
batch_size: BATCH_SIZE,
track_jobs: true
)
end
def down
# NO OP
end
end
|