diff --git a/db/migrate/20220829184824_add_words_to_tags.rb b/db/migrate/20220829184824_add_words_to_tags.rb new file mode 100644 index 000000000..d2d94f8fd --- /dev/null +++ b/db/migrate/20220829184824_add_words_to_tags.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +class AddWordsToTags < ActiveRecord::Migration[7.0] + disable_ddl_transaction! + + def change + add_column :tags, :words, :string, null: false, array: true, default: [], if_not_exists: true + add_index :tags, "array_to_tsvector(words)", using: :gin, if_not_exists: true, algorithm: :concurrently + end +end diff --git a/db/structure.sql b/db/structure.sql index 489e59819..abe268125 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -1896,7 +1896,8 @@ CREATE TABLE public.tags ( created_at timestamp without time zone NOT NULL, updated_at timestamp without time zone NOT NULL, is_locked boolean DEFAULT false NOT NULL, - is_deprecated boolean DEFAULT false NOT NULL + is_deprecated boolean DEFAULT false NOT NULL, + words character varying[] DEFAULT '{}'::character varying[] NOT NULL ); @@ -4605,6 +4606,13 @@ CREATE INDEX index_tag_implications_on_consequent_name ON public.tag_implication CREATE INDEX index_tag_implications_on_forum_post_id ON public.tag_implications USING btree (forum_post_id); +-- +-- Name: index_tags_on_array_to_tsvector_words; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX index_tags_on_array_to_tsvector_words ON public.tags USING gin (array_to_tsvector((words)::text[])); + + -- -- Name: index_tags_on_is_deprecated; Type: INDEX; Schema: public; Owner: - -- @@ -5976,6 +5984,7 @@ INSERT INTO "schema_migrations" (version) VALUES ('20220514175125'), ('20220525214746'), ('20220623052547'), -('20220627211714'); +('20220627211714'), +('20220829184824');