diff options
author | Alexis Reigel <mail@koffeinfrei.org> | 2017-06-14 10:17:34 +0300 |
---|---|---|
committer | Alexis Reigel <mail@koffeinfrei.org> | 2017-07-27 16:42:53 +0300 |
commit | 8236b12dff3df6d223888664c820ae54b4e0eaf7 (patch) | |
tree | 4ece75be33d55ca12173cb7b3162fe275a76958c /db | |
parent | 2f956fae0399f6f2eb370ed186c7bb4a9486178b (diff) |
gpg signature model for gpg verification caching
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20170613154149_create_gpg_signatures.rb | 29 | ||||
-rw-r--r-- | db/schema.rb | 17 |
2 files changed, 46 insertions, 0 deletions
diff --git a/db/migrate/20170613154149_create_gpg_signatures.rb b/db/migrate/20170613154149_create_gpg_signatures.rb new file mode 100644 index 00000000000..72560cdb6d0 --- /dev/null +++ b/db/migrate/20170613154149_create_gpg_signatures.rb @@ -0,0 +1,29 @@ +class CreateGpgSignatures < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + create_table :gpg_signatures do |t| + t.string :commit_sha + 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 + + 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) + + drop_table :gpg_signatures + end +end diff --git a/db/schema.rb b/db/schema.rb index fbf20f4eb66..53b1e83ddab 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -552,6 +552,21 @@ ActiveRecord::Schema.define(version: 20170725145659) do 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.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 + end + + add_index "gpg_signatures", ["commit_sha"], name: "index_gpg_signatures_on_commit_sha", using: :btree + add_index "gpg_signatures", ["gpg_key_id"], name: "index_gpg_signatures_on_gpg_key_id", using: :btree + add_index "gpg_signatures", ["gpg_key_primary_keyid"], name: "index_gpg_signatures_on_gpg_key_primary_keyid", using: :btree + add_index "gpg_signatures", ["project_id"], name: "index_gpg_signatures_on_project_id", using: :btree + create_table "identities", force: :cascade do |t| t.string "extern_uid" t.string "provider" @@ -1615,6 +1630,8 @@ ActiveRecord::Schema.define(version: 20170725145659) do add_foreign_key "events", "projects", name: "fk_0434b48643", on_delete: :cascade add_foreign_key "forked_project_links", "projects", column: "forked_to_project_id", name: "fk_434510edb0", on_delete: :cascade add_foreign_key "gpg_keys", "users" + add_foreign_key "gpg_signatures", "gpg_keys" + add_foreign_key "gpg_signatures", "projects" add_foreign_key "issue_assignees", "issues", name: "fk_b7d881734a", on_delete: :cascade add_foreign_key "issue_assignees", "users", name: "fk_5e0c8d9154", on_delete: :cascade add_foreign_key "issue_metrics", "issues", on_delete: :cascade |