Commit 9eddfadc authored by Mayra Cabrera's avatar Mayra Cabrera

Merge branch 'index-cluster-agent-tokens-on-status' into 'master'

Add index for selecting active agent tokens

See merge request gitlab-org/gitlab!77923
parents 002dfb30 732ecd9c
# frozen_string_literal: true
class IndexClusterAgentTokensOnStatus < Gitlab::Database::Migration[1.0]
disable_ddl_transaction!
INDEX_NAME = 'index_cluster_agent_tokens_on_agent_id_status_last_used_at'
def up
add_concurrent_index :cluster_agent_tokens, 'agent_id, status, last_used_at DESC NULLS LAST', name: INDEX_NAME
end
def down
remove_concurrent_index_by_name :cluster_agent_tokens, INDEX_NAME
end
end
fdb6e193748f9933aa3ae60fab41960e06d4edf271048fc5f6c9c465d30a8334
\ No newline at end of file
...@@ -25671,6 +25671,8 @@ CREATE UNIQUE INDEX index_ci_variables_on_project_id_and_key_and_environment_sco ...@@ -25671,6 +25671,8 @@ CREATE UNIQUE INDEX index_ci_variables_on_project_id_and_key_and_environment_sco
CREATE INDEX index_cluster_agent_tokens_on_agent_id_and_last_used_at ON cluster_agent_tokens USING btree (agent_id, last_used_at DESC NULLS LAST); CREATE INDEX index_cluster_agent_tokens_on_agent_id_and_last_used_at ON cluster_agent_tokens USING btree (agent_id, last_used_at DESC NULLS LAST);
CREATE INDEX index_cluster_agent_tokens_on_agent_id_status_last_used_at ON cluster_agent_tokens USING btree (agent_id, status, last_used_at DESC NULLS LAST);
CREATE INDEX index_cluster_agent_tokens_on_created_by_user_id ON cluster_agent_tokens USING btree (created_by_user_id); CREATE INDEX index_cluster_agent_tokens_on_created_by_user_id ON cluster_agent_tokens USING btree (created_by_user_id);
CREATE UNIQUE INDEX index_cluster_agent_tokens_on_token_encrypted ON cluster_agent_tokens USING btree (token_encrypted); CREATE UNIQUE INDEX index_cluster_agent_tokens_on_token_encrypted ON cluster_agent_tokens USING btree (token_encrypted);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment