Added new index to deploy_tokens table

This commit is contained in:
Etienne Baqué 2019-07-19 14:00:56 -04:00 committed by Stan Hu
parent 84d6dcbe50
commit 64e24d6492
2 changed files with 18 additions and 0 deletions

View File

@ -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

View File

@ -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|