summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorEtienne BaquƩ <ebaque@gitlab.com>2019-07-19 14:00:56 -0400
committerStan Hu <stanhu@gmail.com>2019-08-26 19:39:48 -0700
commit64e24d6492f39a4ab7f2202897755afd1704f147 (patch)
treea94106a6dfb906e91084265ae3b8d75cad5d6b27 /db
parent84d6dcbe5040b9f0475f6b2155800617e397db94 (diff)
downloadgitlab-ce-64e24d6492f39a4ab7f2202897755afd1704f147.tar.gz
Added new index to deploy_tokens table
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20190719174505_add_index_to_deploy_tokens_token_encrypted.rb17
-rw-r--r--db/schema.rb1
2 files changed, 18 insertions, 0 deletions
diff --git a/db/migrate/20190719174505_add_index_to_deploy_tokens_token_encrypted.rb b/db/migrate/20190719174505_add_index_to_deploy_tokens_token_encrypted.rb
new file mode 100644
index 00000000000..d58d1d8348c
--- /dev/null
+++ b/db/migrate/20190719174505_add_index_to_deploy_tokens_token_encrypted.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddIndexToDeployTokensTokenEncrypted < ActiveRecord::Migration[5.1]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :deploy_tokens, :token_encrypted, unique: true, name: "index_deploy_tokens_on_token_encrypted"
+ end
+
+ def down
+ remove_concurrent_index_by_name :deploy_tokens, "index_deploy_tokens_on_token_encrypted"
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index f36ee372382..1393737b8b9 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -1126,6 +1126,7 @@ ActiveRecord::Schema.define(version: 2019_08_20_163320) do
t.string "token_encrypted"
t.index ["token", "expires_at", "id"], name: "index_deploy_tokens_on_token_and_expires_at_and_id", where: "(revoked IS FALSE)"
t.index ["token"], name: "index_deploy_tokens_on_token", unique: true
+ t.index ["token_encrypted"], name: "index_deploy_tokens_on_token_encrypted", unique: true
end
create_table "deployments", id: :serial, force: :cascade do |t|