summaryrefslogtreecommitdiff
path: root/db
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
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')
-rw-r--r--db/migrate/20170222111732_create_gpg_keys.rb9
-rw-r--r--db/migrate/20170613103429_add_primary_keyid_to_gpg_keys.rb17
-rw-r--r--db/migrate/20170613154149_create_gpg_signatures.rb29
-rw-r--r--db/migrate/20170713104235_add_gpg_key_user_info_to_gpg_signatures.rb11
-rw-r--r--db/schema.rb14
5 files changed, 25 insertions, 55 deletions
diff --git a/db/migrate/20170222111732_create_gpg_keys.rb b/db/migrate/20170222111732_create_gpg_keys.rb
index 1b8b7a91fe1..55dc730e884 100644
--- a/db/migrate/20170222111732_create_gpg_keys.rb
+++ b/db/migrate/20170222111732_create_gpg_keys.rb
@@ -3,11 +3,16 @@ class CreateGpgKeys < ActiveRecord::Migration
def change
create_table :gpg_keys do |t|
+ t.timestamps_with_timezone null: false
+
+ t.references :user, index: true, foreign_key: true
+
t.string :fingerprint
+ t.string :primary_keyid
+
t.text :key
- t.references :user, index: true, foreign_key: true
- t.timestamps_with_timezone null: false
+ t.index :primary_keyid
end
end
end
diff --git a/db/migrate/20170613103429_add_primary_keyid_to_gpg_keys.rb b/db/migrate/20170613103429_add_primary_keyid_to_gpg_keys.rb
deleted file mode 100644
index 13f0500971b..00000000000
--- a/db/migrate/20170613103429_add_primary_keyid_to_gpg_keys.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-class AddPrimaryKeyidToGpgKeys < ActiveRecord::Migration
- include Gitlab::Database::MigrationHelpers
-
- DOWNTIME = false
-
- disable_ddl_transaction!
-
- def up
- add_column :gpg_keys, :primary_keyid, :string
- add_concurrent_index :gpg_keys, :primary_keyid
- end
-
- def down
- remove_concurrent_index :gpg_keys, :primary_keyid if index_exists?(:gpg_keys, :primary_keyid)
- remove_column :gpg_keys, :primary_keyid, :string
- end
-end
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
diff --git a/db/migrate/20170713104235_add_gpg_key_user_info_to_gpg_signatures.rb b/db/migrate/20170713104235_add_gpg_key_user_info_to_gpg_signatures.rb
deleted file mode 100644
index 0e51a86e64c..00000000000
--- a/db/migrate/20170713104235_add_gpg_key_user_info_to_gpg_signatures.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-# See http://doc.gitlab.com/ce/development/migration_style_guide.html
-# for more information on how to write migrations for GitLab.
-
-class AddGpgKeyUserInfoToGpgSignatures < ActiveRecord::Migration
- DOWNTIME = false
-
- def change
- add_column :gpg_signatures, :gpg_key_user_name, :string
- add_column :gpg_signatures, :gpg_key_user_email, :string
- end
-end
diff --git a/db/schema.rb b/db/schema.rb
index b76a5efbbd7..f413aaa41cd 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -541,25 +541,25 @@ ActiveRecord::Schema.define(version: 20170725145659) do
add_index "forked_project_links", ["forked_to_project_id"], name: "index_forked_project_links_on_forked_to_project_id", unique: true, using: :btree
create_table "gpg_keys", force: :cascade do |t|
- t.string "fingerprint"
- t.text "key"
- t.integer "user_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
+ t.integer "user_id"
+ t.string "fingerprint"
t.string "primary_keyid"
+ t.text "key"
end
add_index "gpg_keys", ["primary_keyid"], name: "index_gpg_keys_on_primary_keyid", using: :btree
add_index "gpg_keys", ["user_id"], name: "index_gpg_keys_on_user_id", using: :btree
create_table "gpg_signatures", force: :cascade do |t|
- t.string "commit_sha"
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
t.integer "project_id"
t.integer "gpg_key_id"
- t.string "gpg_key_primary_keyid"
t.boolean "valid_signature"
- t.datetime "created_at", null: false
- t.datetime "updated_at", null: false
+ t.string "commit_sha"
+ t.string "gpg_key_primary_keyid"
t.string "gpg_key_user_name"
t.string "gpg_key_user_email"
end