diff options
author | Alexis Reigel <mail@koffeinfrei.org> | 2017-09-04 11:45:17 +0200 |
---|---|---|
committer | Alexis Reigel <mail@koffeinfrei.org> | 2017-09-05 12:18:34 +0200 |
commit | 703b39d4405af553b142071634db006941272db6 (patch) | |
tree | ea83ff7967d56436abae45ba7ea223b564015f9a | |
parent | c4bb09bdb80817b84b6fbbdbda75907125c0512d (diff) | |
download | gitlab-ce-703b39d4405af553b142071634db006941272db6.tar.gz |
truncate gpg signature instead of destroy
-rw-r--r-- | db/migrate/20170817123339_add_verification_status_to_gpg_signatures.rb | 10 | ||||
-rw-r--r-- | db/post_migrate/20170830084744_destroy_gpg_signatures.rb | 13 |
2 files changed, 2 insertions, 21 deletions
diff --git a/db/migrate/20170817123339_add_verification_status_to_gpg_signatures.rb b/db/migrate/20170817123339_add_verification_status_to_gpg_signatures.rb index 126036a95d8..128cd109f8d 100644 --- a/db/migrate/20170817123339_add_verification_status_to_gpg_signatures.rb +++ b/db/migrate/20170817123339_add_verification_status_to_gpg_signatures.rb @@ -4,20 +4,12 @@ class AddVerificationStatusToGpgSignatures < ActiveRecord::Migration include Gitlab::Database::MigrationHelpers disable_ddl_transaction! - class GpgSignature < ActiveRecord::Base - self.table_name = 'gpg_signatures' - - include EachBatch - end - def up # First we remove all signatures because we need to re-verify them all # again anyway (because of the updated verification logic). # # This makes adding the column with default values faster - GpgSignature.each_batch do |relation| - relation.delete_all - end + truncate(:gpg_signatures) add_column_with_default(:gpg_signatures, :verification_status, :smallint, default: 0) end diff --git a/db/post_migrate/20170830084744_destroy_gpg_signatures.rb b/db/post_migrate/20170830084744_destroy_gpg_signatures.rb index de2e7e79e86..b04d36f6537 100644 --- a/db/post_migrate/20170830084744_destroy_gpg_signatures.rb +++ b/db/post_migrate/20170830084744_destroy_gpg_signatures.rb @@ -1,19 +1,8 @@ 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 + truncate(:gpg_signatures) end def down |