summaryrefslogtreecommitdiff
path: root/db/migrate/20170613154149_create_gpg_signatures.rb
diff options
context:
space:
mode:
authorAlexis Reigel <mail@koffeinfrei.org>2017-07-15 15:25:21 +0200
committerAlexis Reigel <mail@koffeinfrei.org>2017-07-27 15:46:03 +0200
commit8c8a9e6d3fcb529e95d76dc9a7d4e37542a2036f (patch)
tree7464778b069b8cb8477e20a24c366b1f4fcea793 /db/migrate/20170613154149_create_gpg_signatures.rb
parent312dc89a44642050a2224c1b780054828c819fd6 (diff)
downloadgitlab-ce-8c8a9e6d3fcb529e95d76dc9a7d4e37542a2036f.tar.gz
merge migrations to 1 single create per table
also: * reorder table columns * no need for `add_concurrent_index` * no need for explicit index removal on `#down`
Diffstat (limited to 'db/migrate/20170613154149_create_gpg_signatures.rb')
-rw-r--r--db/migrate/20170613154149_create_gpg_signatures.rb29
1 files changed, 11 insertions, 18 deletions
diff --git a/db/migrate/20170613154149_create_gpg_signatures.rb b/db/migrate/20170613154149_create_gpg_signatures.rb
index 72560cdb6d0..515c1413cf4 100644
--- a/db/migrate/20170613154149_create_gpg_signatures.rb
+++ b/db/migrate/20170613154149_create_gpg_signatures.rb
@@ -1,29 +1,22 @@
class CreateGpgSignatures < ActiveRecord::Migration
- include Gitlab::Database::MigrationHelpers
-
DOWNTIME = false
- disable_ddl_transaction!
-
- def up
+ def change
create_table :gpg_signatures do |t|
- t.string :commit_sha
+ t.timestamps_with_timezone null: false
+
t.references :project, index: true, foreign_key: true
t.references :gpg_key, index: true, foreign_key: true
- t.string :gpg_key_primary_keyid
- t.boolean :valid_signature
- t.timestamps_with_timezone null: false
- end
-
- add_concurrent_index :gpg_signatures, :commit_sha
- add_concurrent_index :gpg_signatures, :gpg_key_primary_keyid
- end
+ t.boolean :valid_signature
- def down
- remove_concurrent_index :gpg_signatures, :commit_sha if index_exists?(:gpg_signatures, :commit_sha)
- remove_concurrent_index :gpg_signatures, :gpg_key_primary_keyid if index_exists?(:gpg_signatures, :gpg_key_primary_keyid)
+ t.string :commit_sha
+ t.string :gpg_key_primary_keyid
+ t.string :gpg_key_user_name
+ t.string :gpg_key_user_email
- drop_table :gpg_signatures
+ t.index :commit_sha
+ t.index :gpg_key_primary_keyid
+ end
end
end