diff --git a/db/migrate/20210425020131_create_missing_user_id_indexes.rb b/db/migrate/20210425020131_create_missing_user_id_indexes.rb new file mode 100644 index 000000000..8da9af2eb --- /dev/null +++ b/db/migrate/20210425020131_create_missing_user_id_indexes.rb @@ -0,0 +1,9 @@ +class CreateMissingUserIdIndexes < ActiveRecord::Migration[6.1] + def change + add_index :favorites, :user_id + add_index :favorites, :post_id + add_index :post_votes, :user_id + add_index :post_votes, :post_id + add_index :comments, :creator_id + end +end diff --git a/db/structure.sql b/db/structure.sql index abf39393e..d765b1e7f 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -3885,6 +3885,13 @@ CREATE INDEX index_comment_votes_on_user_id ON public.comment_votes USING btree CREATE INDEX index_comments_on_body_index ON public.comments USING gin (body_index); +-- +-- Name: index_comments_on_creator_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX index_comments_on_creator_id ON public.comments USING btree (creator_id); + + -- -- Name: index_comments_on_creator_id_and_post_id; Type: INDEX; Schema: public; Owner: - -- @@ -3976,6 +3983,20 @@ CREATE INDEX index_favorite_groups_on_creator_id ON public.favorite_groups USING CREATE INDEX index_favorite_groups_on_lower_name ON public.favorite_groups USING btree (lower(name)); +-- +-- Name: index_favorites_on_post_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX index_favorites_on_post_id ON public.favorites USING btree (post_id); + + +-- +-- Name: index_favorites_on_user_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX index_favorites_on_user_id ON public.favorites USING btree (user_id); + + -- -- Name: index_favorites_on_user_id_and_post_id; Type: INDEX; Schema: public; Owner: - -- @@ -4389,6 +4410,20 @@ CREATE INDEX index_post_versions_on_updater_id ON public.post_versions USING btr CREATE INDEX index_post_versions_on_updater_ip_addr ON public.post_versions USING btree (updater_ip_addr); +-- +-- Name: index_post_votes_on_post_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX index_post_votes_on_post_id ON public.post_votes USING btree (post_id); + + +-- +-- Name: index_post_votes_on_user_id; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX index_post_votes_on_user_id ON public.post_votes USING btree (user_id); + + -- -- Name: index_post_votes_on_user_id_and_post_id; Type: INDEX; Schema: public; Owner: - -- @@ -5091,5 +5126,7 @@ INSERT INTO "schema_migrations" (version) VALUES ('20201220172926'), ('20201220190335'), ('20210117173030'), -('20210405040522'); +('20210405040522'), +('20210425020131'); +