summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-04-02 09:08:14 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-04-02 09:08:14 +0000
commitade18c9d68d5a2e6c6e28ef7e9d3add3b3491ace (patch)
treecf4154332fc95283f58cccb1383e43b40485d91d /db
parentba836d98593d68d8d6c22c540e31c8031a786bd8 (diff)
downloadgitlab-ce-ade18c9d68d5a2e6c6e28ef7e9d3add3b3491ace.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20200330132913_add_index_on_author_id_and_created_at_and_id_to_notes.rb19
-rw-r--r--db/structure.sql3
2 files changed, 21 insertions, 1 deletions
diff --git a/db/migrate/20200330132913_add_index_on_author_id_and_created_at_and_id_to_notes.rb b/db/migrate/20200330132913_add_index_on_author_id_and_created_at_and_id_to_notes.rb
new file mode 100644
index 00000000000..3b0a63ee565
--- /dev/null
+++ b/db/migrate/20200330132913_add_index_on_author_id_and_created_at_and_id_to_notes.rb
@@ -0,0 +1,19 @@
+# frozen_string_literal: true
+
+class AddIndexOnAuthorIdAndCreatedAtAndIdToNotes < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :notes, [:author_id, :created_at, :id]
+ remove_concurrent_index :notes, [:author_id, :created_at]
+ end
+
+ def down
+ add_concurrent_index :notes, [:author_id, :created_at]
+ remove_concurrent_index :notes, [:author_id, :created_at, :id]
+ end
+end
diff --git a/db/structure.sql b/db/structure.sql
index 86a931b6cb4..bbd6312b08a 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -9519,7 +9519,7 @@ CREATE INDEX index_namespaces_on_type_partial ON public.namespaces USING btree (
CREATE UNIQUE INDEX index_note_diff_files_on_diff_note_id ON public.note_diff_files USING btree (diff_note_id);
-CREATE INDEX index_notes_on_author_id_and_created_at ON public.notes USING btree (author_id, created_at);
+CREATE INDEX index_notes_on_author_id_and_created_at_and_id ON public.notes USING btree (author_id, created_at, id);
CREATE INDEX index_notes_on_commit_id ON public.notes USING btree (commit_id);
@@ -12925,5 +12925,6 @@ COPY "schema_migrations" (version) FROM STDIN;
20200326144443
20200326145443
20200330074719
+20200330132913
\.