Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-04-21 12:09:15 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-04-21 12:09:15 +0300
commitd89b82481b3ee5a226bab905555dd9c6a4708521 (patch)
treed10aa55e4ad8a6404f4e02d53b9f3f96a0c99fa7 /db
parent430aebe8afe80c67d1bafcc5c68cd28e5f207639 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20210420012909_index_cluster_agent_tokens_on_last_used_at.rb20
-rw-r--r--db/schema_migrations/202104200129091
-rw-r--r--db/structure.sql2
3 files changed, 22 insertions, 1 deletions
diff --git a/db/migrate/20210420012909_index_cluster_agent_tokens_on_last_used_at.rb b/db/migrate/20210420012909_index_cluster_agent_tokens_on_last_used_at.rb
new file mode 100644
index 00000000000..c1715d8ac29
--- /dev/null
+++ b/db/migrate/20210420012909_index_cluster_agent_tokens_on_last_used_at.rb
@@ -0,0 +1,20 @@
+# frozen_string_literal: true
+
+class IndexClusterAgentTokensOnLastUsedAt < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ OLD_INDEX = 'index_cluster_agent_tokens_on_agent_id'
+ NEW_INDEX = 'index_cluster_agent_tokens_on_agent_id_and_last_used_at'
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :cluster_agent_tokens, 'agent_id, last_used_at DESC NULLS LAST', name: NEW_INDEX
+ remove_concurrent_index_by_name :cluster_agent_tokens, OLD_INDEX
+ end
+
+ def down
+ add_concurrent_index :cluster_agent_tokens, :agent_id, name: OLD_INDEX
+ remove_concurrent_index_by_name :cluster_agent_tokens, NEW_INDEX
+ end
+end
diff --git a/db/schema_migrations/20210420012909 b/db/schema_migrations/20210420012909
new file mode 100644
index 00000000000..e4e00349df7
--- /dev/null
+++ b/db/schema_migrations/20210420012909
@@ -0,0 +1 @@
+c9e8c49bf272ef49d906431bdc11a24abe967a9d7e95976d70c48b21b48a062b \ No newline at end of file
diff --git a/db/structure.sql b/db/structure.sql
index ad34d16bbda..fcc36aafc7e 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -22324,7 +22324,7 @@ CREATE INDEX index_ci_variables_on_key ON ci_variables USING btree (key);
CREATE UNIQUE INDEX index_ci_variables_on_project_id_and_key_and_environment_scope ON ci_variables USING btree (project_id, key, environment_scope);
-CREATE INDEX index_cluster_agent_tokens_on_agent_id ON cluster_agent_tokens USING btree (agent_id);
+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_created_by_user_id ON cluster_agent_tokens USING btree (created_by_user_id);