Commit 703b39d4 authored by Alexis Reigel's avatar Alexis Reigel

truncate gpg signature instead of destroy

parent c4bb09bd
...@@ -4,20 +4,12 @@ class AddVerificationStatusToGpgSignatures < ActiveRecord::Migration ...@@ -4,20 +4,12 @@ class AddVerificationStatusToGpgSignatures < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers include Gitlab::Database::MigrationHelpers
disable_ddl_transaction! disable_ddl_transaction!
class GpgSignature < ActiveRecord::Base
self.table_name = 'gpg_signatures'
include EachBatch
end
def up def up
# First we remove all signatures because we need to re-verify them all # First we remove all signatures because we need to re-verify them all
# again anyway (because of the updated verification logic). # again anyway (because of the updated verification logic).
# #
# This makes adding the column with default values faster # This makes adding the column with default values faster
GpgSignature.each_batch do |relation| truncate(:gpg_signatures)
relation.delete_all
end
add_column_with_default(:gpg_signatures, :verification_status, :smallint, default: 0) add_column_with_default(:gpg_signatures, :verification_status, :smallint, default: 0)
end end
......
class DestroyGpgSignatures < ActiveRecord::Migration class DestroyGpgSignatures < ActiveRecord::Migration
DOWNTIME = false DOWNTIME = false
include Gitlab::Database::MigrationHelpers
disable_ddl_transaction!
class GpgSignature < ActiveRecord::Base
self.table_name = 'gpg_signatures'
include EachBatch
end
def up def up
GpgSignature.each_batch do |relation| truncate(:gpg_signatures)
relation.delete_all
end
end end
def down def down
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment