diff options
author | Mark Chao <mchao@gitlab.com> | 2018-09-27 15:54:01 +0800 |
---|---|---|
committer | Mark Chao <mchao@gitlab.com> | 2018-11-05 20:09:11 +0800 |
commit | c4bcb3a92ad6adb1acc76f337660d755e9db5409 (patch) | |
tree | ff6abe6319e65d77e5958f7def0f7c0d2506e8de | |
parent | 961d43a97b9a971e69b94f0882602746c493e455 (diff) | |
download | gitlab-ce-c4bcb3a92ad6adb1acc76f337660d755e9db5409.tar.gz |
Add index to speed up loading projects from DeployToken
-rw-r--r-- | db/migrate/20180927073410_add_index_to_project_deploy_tokens_deploy_token_id.rb | 17 | ||||
-rw-r--r-- | db/schema.rb | 1 |
2 files changed, 18 insertions, 0 deletions
diff --git a/db/migrate/20180927073410_add_index_to_project_deploy_tokens_deploy_token_id.rb b/db/migrate/20180927073410_add_index_to_project_deploy_tokens_deploy_token_id.rb new file mode 100644 index 00000000000..cd78779068a --- /dev/null +++ b/db/migrate/20180927073410_add_index_to_project_deploy_tokens_deploy_token_id.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +class AddIndexToProjectDeployTokensDeployTokenId < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_concurrent_index :project_deploy_tokens, :deploy_token_id + end + + def down + remove_concurrent_index(:project_deploy_tokens, :deploy_token_id) if Gitlab::Database.postgresql? + end +end diff --git a/db/schema.rb b/db/schema.rb index 1a8b556228d..133b46819d0 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -1588,6 +1588,7 @@ ActiveRecord::Schema.define(version: 20181101144347) do t.datetime_with_timezone "created_at", null: false end + add_index "project_deploy_tokens", ["deploy_token_id"], name: "index_project_deploy_tokens_on_deploy_token_id", using: :btree add_index "project_deploy_tokens", ["project_id", "deploy_token_id"], name: "index_project_deploy_tokens_on_project_id_and_deploy_token_id", unique: true, using: :btree create_table "project_features", force: :cascade do |t| |