Commit 4f0de501 authored by Yannis Roussos's avatar Yannis Roussos

Merge branch 'update-index-used-in-mr-api' into 'master'

Update MR index to include id

See merge request gitlab-org/gitlab!42222
parents 06766b6a 57c47fc0
---
title: Update MR index to include id
merge_request: 42222
author:
type: performance
# frozen_string_literal: true
# See https://docs.gitlab.com/ee/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.
class ModifyMergeRequestApiIndex < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
def up
add_concurrent_index :merge_requests, [:target_project_id, :created_at, :id], name: :index_merge_requests_on_target_project_id_and_created_at_and_id
end
def down
remove_concurrent_index :merge_requests, [:target_project_id, :created_at, :id], name: :index_merge_requests_on_target_project_id_and_created_at_and_id
end
end
# frozen_string_literal: true
class RemoveOldMergeRequestApiIndex < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
def up
remove_concurrent_index :merge_requests, [:target_project_id, :created_at], name: :index_merge_requests_target_project_id_created_at
end
def down
add_concurrent_index :merge_requests, [:target_project_id, :created_at], name: :index_merge_requests_target_project_id_created_at
end
end
49b492717acca6d43e16caafda0b75f6e1a3630592149b04d1148758406ae1a7
\ No newline at end of file
6cd644220e07f477a87ddc8bb8b2de3ed920c0c76383122bab95c939e21abbb2
\ No newline at end of file
......@@ -20329,6 +20329,8 @@ CREATE INDEX index_merge_requests_on_sprint_id ON public.merge_requests USING bt
CREATE INDEX index_merge_requests_on_target_branch ON public.merge_requests USING btree (target_branch);
CREATE INDEX index_merge_requests_on_target_project_id_and_created_at_and_id ON public.merge_requests USING btree (target_project_id, created_at, id);
CREATE UNIQUE INDEX index_merge_requests_on_target_project_id_and_iid ON public.merge_requests USING btree (target_project_id, iid);
CREATE INDEX index_merge_requests_on_target_project_id_and_target_branch ON public.merge_requests USING btree (target_project_id, target_branch) WHERE ((state_id = 1) AND (merge_when_pipeline_succeeds = true));
......@@ -20341,8 +20343,6 @@ CREATE INDEX index_merge_requests_on_tp_id_and_merge_commit_sha_and_id ON public
CREATE INDEX index_merge_requests_on_updated_by_id ON public.merge_requests USING btree (updated_by_id) WHERE (updated_by_id IS NOT NULL);
CREATE INDEX index_merge_requests_target_project_id_created_at ON public.merge_requests USING btree (target_project_id, created_at);
CREATE UNIQUE INDEX index_merge_trains_on_merge_request_id ON public.merge_trains USING btree (merge_request_id);
CREATE INDEX index_merge_trains_on_pipeline_id ON public.merge_trains USING btree (pipeline_id);
......
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