From 1946c84f710e0fc2067bb9880c2bac16f0406db5 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Tue, 6 Oct 2020 22:42:44 +0100 Subject: [PATCH] Index changeset comments by author and date --- ...201006213836_add_author_index_to_changeset_comments.rb | 7 +++++++ db/structure.sql | 8 ++++++++ 2 files changed, 15 insertions(+) create mode 100644 db/migrate/20201006213836_add_author_index_to_changeset_comments.rb diff --git a/db/migrate/20201006213836_add_author_index_to_changeset_comments.rb b/db/migrate/20201006213836_add_author_index_to_changeset_comments.rb new file mode 100644 index 000000000..fd2af3399 --- /dev/null +++ b/db/migrate/20201006213836_add_author_index_to_changeset_comments.rb @@ -0,0 +1,7 @@ +class AddAuthorIndexToChangesetComments < ActiveRecord::Migration[6.0] + disable_ddl_transaction! + + def change + add_index :changeset_comments, [:author_id, :created_at], :algorithm => :concurrently + end +end diff --git a/db/structure.sql b/db/structure.sql index 75edb001e..58d7b6653 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -2255,6 +2255,13 @@ CREATE UNIQUE INDEX index_active_storage_attachments_uniqueness ON public.active CREATE UNIQUE INDEX index_active_storage_blobs_on_key ON public.active_storage_blobs USING btree (key); +-- +-- Name: index_changeset_comments_on_author_id_and_created_at; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX index_changeset_comments_on_author_id_and_created_at ON public.changeset_comments USING btree (author_id, created_at); + + -- -- Name: index_changeset_comments_on_created_at; Type: INDEX; Schema: public; Owner: - -- @@ -3138,6 +3145,7 @@ INSERT INTO "schema_migrations" (version) VALUES ('20190702193519'), ('20190716173946'), ('20191120140058'), +('20201006213836'), ('21'), ('22'), ('23'), -- 2.43.2