diff options
author | Rubén Dávila <ruben@gitlab.com> | 2017-10-05 10:17:18 -0500 |
---|---|---|
committer | Rubén Dávila <ruben@gitlab.com> | 2017-10-05 10:17:18 -0500 |
commit | 5595d73763caf224df4109ab2d52e616cd843d49 (patch) | |
tree | 9de3c6d2eb1fdf0bc182fa54acc0c19ca1640802 /db | |
parent | bd8e3606a202273129b963742aa071a0d2c8812f (diff) | |
download | gitlab-ce-5595d73763caf224df4109ab2d52e616cd843d49.tar.gz |
Small refactor and fix for RuboCop
Diffstat (limited to 'db')
-rw-r--r-- | db/post_migrate/20171005130944_schedule_create_gpg_key_subkeys_from_gpg_keys.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/db/post_migrate/20171005130944_schedule_create_gpg_key_subkeys_from_gpg_keys.rb b/db/post_migrate/20171005130944_schedule_create_gpg_key_subkeys_from_gpg_keys.rb index c8bbfbccc08..08c9ce1d3bb 100644 --- a/db/post_migrate/20171005130944_schedule_create_gpg_key_subkeys_from_gpg_keys.rb +++ b/db/post_migrate/20171005130944_schedule_create_gpg_key_subkeys_from_gpg_keys.rb @@ -8,11 +8,13 @@ class ScheduleCreateGpgKeySubkeysFromGpgKeys < ActiveRecord::Migration class GpgKey < ActiveRecord::Base self.table_name = 'gpg_keys' + + include EachBatch end def up - GpgKey.select(:id).in_batches do |relation| - jobs = relation.pluck(:id).map do |id| + GpgKey.select(:id).each_batch do |gpg_keys| + jobs = gpg_keys.pluck(:id).map do |id| ['CreateGpgKeySubkeysFromGpgKeys', [id]] end |