Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRubén Dávila <ruben@gitlab.com>2017-10-04 18:34:50 +0300
committerRubén Dávila <ruben@gitlab.com>2017-10-05 16:26:02 +0300
commit2577cc99818bd0332aa78018de666579971341c8 (patch)
treefc1b4e38a6b63ca696cc966255d6fba7b7dfc9a9 /db/post_migrate
parent8be06f20fc64b027911ad75e05afaf0697444d6a (diff)
Address some feedback from last code review
Diffstat (limited to 'db/post_migrate')
-rw-r--r--db/post_migrate/20171002161539_create_gpg_key_subkeys_for_existing_gpg_keys.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/db/post_migrate/20171002161539_create_gpg_key_subkeys_for_existing_gpg_keys.rb b/db/post_migrate/20171002161539_create_gpg_key_subkeys_for_existing_gpg_keys.rb
index 355fbfbbede..346dfb1a4b6 100644
--- a/db/post_migrate/20171002161539_create_gpg_key_subkeys_for_existing_gpg_keys.rb
+++ b/db/post_migrate/20171002161539_create_gpg_key_subkeys_for_existing_gpg_keys.rb
@@ -28,8 +28,10 @@ class CreateGpgKeySubkeysForExistingGpgKeys < ActiveRecord::Migration
end
def up
- GpgKey.each_batch do |batch|
+ GpgKey.with_subkeys.each_batch do |batch|
batch.each do |gpg_key|
+ return if gpg_key.subkeys.any?
+
create_subkeys(gpg_key) && update_signatures(gpg_key)
end
end