diff options
author | Oswaldo Ferreira <oswaldo@gitlab.com> | 2019-03-22 13:51:47 -0300 |
---|---|---|
committer | Oswaldo Ferreira <oswaldo@gitlab.com> | 2019-03-25 19:50:40 -0300 |
commit | 929ee4d18da886826e9fcc15c35b4d4024bc8237 (patch) | |
tree | 362d6627f738a968fea914e4b264789b1bb6b2a4 /db/post_migrate | |
parent | 09d25b04c34398f9f825b3cc95265af3097fa035 (diff) | |
download | gitlab-ce-929ee4d18da886826e9fcc15c35b4d4024bc8237.tar.gz |
Add multiple assignees migration and table population
This will be further required for supporting multi-assignees MRs
Diffstat (limited to 'db/post_migrate')
-rw-r--r-- | db/post_migrate/20190322132835_schedule_populate_merge_request_assignees_table.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/db/post_migrate/20190322132835_schedule_populate_merge_request_assignees_table.rb b/db/post_migrate/20190322132835_schedule_populate_merge_request_assignees_table.rb new file mode 100644 index 00000000000..1ecb38e1a86 --- /dev/null +++ b/db/post_migrate/20190322132835_schedule_populate_merge_request_assignees_table.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +# See http://doc.gitlab.com/ce/development/migration_style_guide.html +# for more information on how to write migrations for GitLab. + +class SchedulePopulateMergeRequestAssigneesTable < ActiveRecord::Migration[5.0] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + BATCH_SIZE = 10_000 + MIGRATION = 'PopulateMergeRequestAssigneesTable' + DELAY_INTERVAL = 8.minutes.to_i + + disable_ddl_transaction! + + def up + say 'Scheduling `PopulateMergeRequestAssigneesTable` jobs' + # We currently have ~4_500_000 merge request records on GitLab.com. + # This means it'll schedule ~450 jobs (10k MRs each) with a 8 minutes gap, + # so this should take ~60 hours for all background migrations to complete. + queue_background_migration_jobs_by_range_at_intervals(MergeRequest, MIGRATION, DELAY_INTERVAL, batch_size: BATCH_SIZE) + end +end |