# Indexes
#
# index_changeset_comments_on_author_id_and_created_at (author_id,created_at)
+# index_changeset_comments_on_author_id_and_id (author_id,id)
# index_changeset_comments_on_changeset_id_and_created_at (changeset_id,created_at)
# index_changeset_comments_on_created_at (created_at)
#
#
# diary_comment_user_id_created_at_index (user_id,created_at)
# diary_comments_entry_id_idx (diary_entry_id,id) UNIQUE
+# index_diary_comments_on_user_id_and_id (user_id,id)
#
# Foreign Keys
#
--- /dev/null
+class AddUserCommentIndexes < ActiveRecord::Migration[7.2]
+ disable_ddl_transaction!
+
+ def change
+ add_index :changeset_comments, [:author_id, :id], :algorithm => :concurrently
+ add_index :diary_comments, [:user_id, :id], :algorithm => :concurrently
+ end
+end
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_author_id_and_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_changeset_comments_on_author_id_and_id ON public.changeset_comments USING btree (author_id, id);
+
+
--
-- Name: index_changeset_comments_on_changeset_id_and_created_at; Type: INDEX; Schema: public; Owner: -
--
CREATE UNIQUE INDEX index_changesets_subscribers_on_subscriber_id_and_changeset_id ON public.changesets_subscribers USING btree (subscriber_id, changeset_id);
+--
+-- Name: index_diary_comments_on_user_id_and_id; Type: INDEX; Schema: public; Owner: -
+--
+
+CREATE INDEX index_diary_comments_on_user_id_and_id ON public.diary_comments USING btree (user_id, id);
+
+
--
-- Name: index_diary_entry_subscriptions_on_diary_entry_id; Type: INDEX; Schema: public; Owner: -
--
('23'),
('22'),
('21'),
+('20250121191749'),
('20250105154621'),
('20250104140952'),
('20241023004427'),