diff options
author | Igor Drozdov <idrozdov@gitlab.com> | 2019-07-02 17:42:58 +0300 |
---|---|---|
committer | Igor Drozdov <idrozdov@gitlab.com> | 2019-07-09 12:13:55 +0300 |
commit | 184807b253991bc0aed20cad038c6d6602b5dba8 (patch) | |
tree | fd6f78064cb5926a65a8892e352464c47fb64d64 /lib/gitlab/background_migration | |
parent | 775910d3726007c94c74e49f3f243464e50d65f0 (diff) |
Add cleanup migration for MR's mutliple assignees
The migration steals the remaining background jobs
of populating MRs with assignees, executes them
synchronously and then makes sure that all the
assignees are migrated
Diffstat (limited to 'lib/gitlab/background_migration')
-rw-r--r-- | lib/gitlab/background_migration/populate_merge_request_assignees_table.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/gitlab/background_migration/populate_merge_request_assignees_table.rb b/lib/gitlab/background_migration/populate_merge_request_assignees_table.rb index a4c6540c61b..eb4bc0aaf28 100644 --- a/lib/gitlab/background_migration/populate_merge_request_assignees_table.rb +++ b/lib/gitlab/background_migration/populate_merge_request_assignees_table.rb @@ -18,6 +18,14 @@ module Gitlab execute("INSERT INTO merge_request_assignees (merge_request_id, user_id) #{select_sql}") end + def perform_all_sync(batch_size:) + MergeRequest.each_batch(of: batch_size) do |batch| + range = batch.pluck('MIN(id)', 'MAX(id)').first + + perform(*range) + end + end + private def merge_request_assignees_not_exists_clause |