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>2020-03-24 21:07:55 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-24 21:07:55 +0300
commit603c7d4cac5e28bc1c75e50c23ed2cbe56f1aafc (patch)
tree907f5b8ee1b6f5aad396e95e3327a08400b9e8ea /db
parent120f4aaedc8fe830a3f572491d240d8ee6addefb (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20200323122201_add_index_on_user_and_created_at_to_ci_builds.rb19
-rw-r--r--db/structure.sql5
2 files changed, 23 insertions, 1 deletions
diff --git a/db/migrate/20200323122201_add_index_on_user_and_created_at_to_ci_builds.rb b/db/migrate/20200323122201_add_index_on_user_and_created_at_to_ci_builds.rb
new file mode 100644
index 00000000000..4f41fc4f478
--- /dev/null
+++ b/db/migrate/20200323122201_add_index_on_user_and_created_at_to_ci_builds.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddIndexOnUserAndCreatedAtToCiBuilds < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ INDEX_NAME = 'index_ci_builds_on_user_id_and_created_at_and_type_eq_ci_build'
+
+ def up
+ add_concurrent_index :ci_builds, [:user_id, :created_at], where: "type = 'Ci::Build'", name: INDEX_NAME
+ end
+
+ def down
+ remove_concurrent_index :ci_builds, INDEX_NAME
+ end
+end
diff --git a/db/structure.sql b/db/structure.sql
index ba03603a7a8..ee6a249093d 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -8603,6 +8603,8 @@ CREATE INDEX index_ci_builds_on_upstream_pipeline_id ON public.ci_builds USING b
CREATE INDEX index_ci_builds_on_user_id ON public.ci_builds USING btree (user_id);
+CREATE INDEX index_ci_builds_on_user_id_and_created_at_and_type_eq_ci_build ON public.ci_builds USING btree (user_id, created_at) WHERE ((type)::text = 'Ci::Build'::text);
+
CREATE INDEX index_ci_builds_project_id_and_status_for_live_jobs_partial2 ON public.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 UNIQUE INDEX index_ci_builds_runner_session_on_build_id ON public.ci_builds_runner_session USING btree (build_id);
@@ -12746,5 +12748,6 @@ INSERT INTO "schema_migrations" (version) VALUES
('20200318165448'),
('20200318175008'),
('20200319203901'),
-('20200323075043');
+('20200323075043'),
+('20200323122201');