db: add category and description indexes on mod_actions table.

This commit is contained in:
evazion
2022-09-18 23:31:30 -05:00
parent 2119a8efc5
commit f55aa85c68
2 changed files with 30 additions and 1 deletions

View File

@@ -0,0 +1,7 @@
class AddIndexesToModActions < ActiveRecord::Migration[7.0]
def change
add_index :mod_actions, :category
add_index :mod_actions, :description, using: :gin, opclass: :gin_trgm_ops
add_index :mod_actions, "to_tsvector('pg_catalog.english', description)", using: :gin
end
end

View File

@@ -4332,6 +4332,13 @@ CREATE UNIQUE INDEX index_media_metadata_on_media_asset_id ON public.media_metad
CREATE INDEX index_media_metadata_on_metadata ON public.media_metadata USING gin (metadata);
--
-- Name: index_mod_actions_on_category; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX index_mod_actions_on_category ON public.mod_actions USING btree (category);
--
-- Name: index_mod_actions_on_created_at; Type: INDEX; Schema: public; Owner: -
--
@@ -4353,6 +4360,20 @@ CREATE INDEX index_mod_actions_on_creator_id ON public.mod_actions USING btree (
CREATE INDEX index_mod_actions_on_creator_id_and_created_at ON public.mod_actions USING btree (creator_id, created_at);
--
-- Name: index_mod_actions_on_description; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX index_mod_actions_on_description ON public.mod_actions USING gin (description public.gin_trgm_ops);
--
-- Name: index_mod_actions_on_to_tsvector_pg_catalog_english_description; Type: INDEX; Schema: public; Owner: -
--
CREATE INDEX index_mod_actions_on_to_tsvector_pg_catalog_english_description ON public.mod_actions USING gin (to_tsvector('english'::regconfig, description));
--
-- Name: index_moderation_reports_on_created_at; Type: INDEX; Schema: public; Owner: -
--
@@ -6694,6 +6715,7 @@ INSERT INTO "schema_migrations" (version) VALUES
('20220913191300'),
('20220913191309'),
('20220917204044'),
('20220918031429');
('20220918031429'),
('20220919041622');