destroy signatures instead of updating them

This is faster for the deployment process, as the destroyed signatures
will be re-generated on demand again, instead of updating them all on
deploy.
This commit is contained in:
Alexis Reigel 2017-08-31 18:02:05 +02:00
parent 7f45dd92ea
commit aa98c36e47
2 changed files with 21 additions and 14 deletions

View File

@ -0,0 +1,21 @@
class DestroyGpgSignatures < ActiveRecord::Migration
DOWNTIME = false
include Gitlab::Database::MigrationHelpers
disable_ddl_transaction!
class GpgSignature < ActiveRecord::Base
self.table_name = 'gpg_signatures'
include EachBatch
end
def up
GpgSignature.each_batch do |relation|
relation.delete_all
end
end
def down
end
end

View File

@ -1,14 +0,0 @@
class UpdateGpgSignaturesVerificationStatus < ActiveRecord::Migration
DOWNTIME = false
def up
GpgSignature.where(verification_status: nil).find_each do |gpg_signature|
gpg_signature.gpg_commit.update_signature!(gpg_signature)
end
end
def down
# we can't revert setting the verification_status, but actually we don't
# need to really, as setting this is not a harmful change.
end
end