diff --git a/db/migrate/20220627211714_add_tag_id_and_score_index_to_ai_tags.rb b/db/migrate/20220627211714_add_tag_id_and_score_index_to_ai_tags.rb new file mode 100644 index 000000000..c771e6393 --- /dev/null +++ b/db/migrate/20220627211714_add_tag_id_and_score_index_to_ai_tags.rb @@ -0,0 +1,6 @@ +class AddTagIdAndScoreIndexToAITags < ActiveRecord::Migration[7.0] + def change + add_index :ai_tags, [:tag_id, :score], if_not_exists: true + remove_index :ai_tags, :tag_id + end +end diff --git a/db/structure.sql b/db/structure.sql index bbf224757..489e59819 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -3149,10 +3149,10 @@ CREATE INDEX index_ai_tags_on_score ON public.ai_tags USING btree (score); -- --- Name: index_ai_tags_on_tag_id; Type: INDEX; Schema: public; Owner: - +-- Name: index_ai_tags_on_tag_id_and_score; Type: INDEX; Schema: public; Owner: - -- -CREATE INDEX index_ai_tags_on_tag_id ON public.ai_tags USING btree (tag_id); +CREATE INDEX index_ai_tags_on_tag_id_and_score ON public.ai_tags USING btree (tag_id, score); -- @@ -5975,6 +5975,7 @@ INSERT INTO "schema_migrations" (version) VALUES ('20220504235329'), ('20220514175125'), ('20220525214746'), -('20220623052547'); +('20220623052547'), +('20220627211714');