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:
parent
7f45dd92ea
commit
aa98c36e47
2 changed files with 21 additions and 14 deletions
21
db/post_migrate/20170830084744_destroy_gpg_signatures.rb
Normal file
21
db/post_migrate/20170830084744_destroy_gpg_signatures.rb
Normal 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
|
|
@ -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
|
Loading…
Reference in a new issue