diff options
author | Andreas Brandl <abrandl@gitlab.com> | 2019-07-12 16:16:08 +0300 |
---|---|---|
committer | Andreas Brandl <abrandl@gitlab.com> | 2019-07-12 16:16:08 +0300 |
commit | 5ea899d34f6332733bb5aee225c5f3ced340cb24 (patch) | |
tree | fd5c031223b2eeb34942fc3c5d3421619f1ce22e /lib/gitlab/background_migration | |
parent | 907154957ef89c1f0df1de3c665418146cc93f98 (diff) | |
parent | 184807b253991bc0aed20cad038c6d6602b5dba8 (diff) |
Merge branch 'id-clean-up-mr-assignees-migration' into 'master'
Add cleanup migration for MR's multiple assignees
See merge request gitlab-org/gitlab-ce!30269
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 |