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>2022-07-27 03:09:12 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-07-27 03:09:12 +0300
commit7a20e32b02213ac566ede54c451c6d0bb6b36338 (patch)
tree37b9b12de2ea0e5dd7d01b650d25e1785e93027d /db
parent34e1ff85f2e4e2ff465de6197f10b06aae64c796 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r--db/post_migrate/20220720090354_remove_pending_builds_covering_index_from_ci_builds.rb26
-rw-r--r--db/schema_migrations/202207200903541
-rw-r--r--db/structure.sql2
3 files changed, 27 insertions, 2 deletions
diff --git a/db/post_migrate/20220720090354_remove_pending_builds_covering_index_from_ci_builds.rb b/db/post_migrate/20220720090354_remove_pending_builds_covering_index_from_ci_builds.rb
new file mode 100644
index 00000000000..fb3d12840cc
--- /dev/null
+++ b/db/post_migrate/20220720090354_remove_pending_builds_covering_index_from_ci_builds.rb
@@ -0,0 +1,26 @@
+# frozen_string_literal: true
+
+class RemovePendingBuildsCoveringIndexFromCiBuilds < Gitlab::Database::Migration[2.0]
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_ci_builds_runner_id_pending_covering'
+
+ def up
+ remove_concurrent_index_by_name :ci_builds, INDEX_NAME
+ end
+
+ # rubocop:disable Migration/PreventIndexCreation
+ def down
+ disable_statement_timeout do
+ unless index_exists_by_name?(:ci_builds, INDEX_NAME)
+ execute <<~SQL.squish
+ CREATE INDEX CONCURRENTLY #{INDEX_NAME}
+ ON ci_builds (runner_id, id)
+ INCLUDE (project_id)
+ WHERE status = 'pending' AND type = 'Ci::Build'
+ SQL
+ end
+ end
+ end
+ # rubocop:enable Migration/PreventIndexCreation
+end
diff --git a/db/schema_migrations/20220720090354 b/db/schema_migrations/20220720090354
new file mode 100644
index 00000000000..f6a34d452ec
--- /dev/null
+++ b/db/schema_migrations/20220720090354
@@ -0,0 +1 @@
+caf9b383524401d5b552d5593aa8ae51d58138759af5aebdec0825818033100d \ No newline at end of file
diff --git a/db/structure.sql b/db/structure.sql
index bb561a304fd..92af077249f 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -27565,8 +27565,6 @@ CREATE INDEX index_ci_builds_on_user_id_and_created_at_and_type_eq_ci_build ON c
CREATE INDEX index_ci_builds_project_id_and_status_for_live_jobs_partial2 ON ci_builds USING btree (project_id, status) WHERE (((type)::text = 'Ci::Build'::text) AND ((status)::text = ANY (ARRAY[('running'::character varying)::text, ('pending'::character varying)::text, ('created'::character varying)::text])));
-CREATE INDEX index_ci_builds_runner_id_pending_covering ON ci_builds USING btree (runner_id, id) INCLUDE (project_id) WHERE (((status)::text = 'pending'::text) AND ((type)::text = 'Ci::Build'::text));
-
CREATE INDEX index_ci_builds_runner_id_running ON ci_builds USING btree (runner_id) WHERE (((status)::text = 'running'::text) AND ((type)::text = 'Ci::Build'::text));
CREATE UNIQUE INDEX index_ci_builds_runner_session_on_build_id ON ci_builds_runner_session USING btree (build_id);