diff options
author | Alexis Reigel <mail@koffeinfrei.org> | 2017-09-04 12:45:17 +0300 |
---|---|---|
committer | Alexis Reigel <mail@koffeinfrei.org> | 2017-09-05 13:18:34 +0300 |
commit | 703b39d4405af553b142071634db006941272db6 (patch) | |
tree | ea83ff7967d56436abae45ba7ea223b564015f9a /db | |
parent | c4bb09bdb80817b84b6fbbdbda75907125c0512d (diff) |
truncate gpg signature instead of destroy
Diffstat (limited to 'db')
-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 |