diff options
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20170222111732_create_gpg_keys.rb | 9 | ||||
-rw-r--r-- | db/migrate/20170613103429_add_primary_keyid_to_gpg_keys.rb | 17 | ||||
-rw-r--r-- | db/migrate/20170613154149_create_gpg_signatures.rb | 29 | ||||
-rw-r--r-- | db/migrate/20170713104235_add_gpg_key_user_info_to_gpg_signatures.rb | 11 | ||||
-rw-r--r-- | db/schema.rb | 14 |
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 |