diff --git a/db/migrate/20171127195124_add_trigram_index_to_tags.rb b/db/migrate/20171127195124_add_trigram_index_to_tags.rb new file mode 100644 index 000000000..a2d187c55 --- /dev/null +++ b/db/migrate/20171127195124_add_trigram_index_to_tags.rb @@ -0,0 +1,9 @@ +class AddTrigramIndexToTags < ActiveRecord::Migration + def up + execute "create index index_tags_on_name_trgm on tags using gin (name gin_trgm_ops)" + end + + def down + execute "drop index index_tags_on_name_trgm" + end +end diff --git a/db/structure.sql b/db/structure.sql index 5796ea19d..bd655ffd4 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -7008,6 +7008,13 @@ CREATE UNIQUE INDEX index_tags_on_name ON tags USING btree (name); CREATE INDEX index_tags_on_name_pattern ON tags USING btree (name text_pattern_ops); +-- +-- Name: index_tags_on_name_trgm; Type: INDEX; Schema: public; Owner: - +-- + +CREATE INDEX index_tags_on_name_trgm ON tags USING gin (name gin_trgm_ops); + + -- -- Name: index_token_buckets_on_user_id; Type: INDEX; Schema: public; Owner: - -- @@ -7521,3 +7528,5 @@ INSERT INTO schema_migrations (version) VALUES ('20170914200122'); INSERT INTO schema_migrations (version) VALUES ('20171106075030'); +INSERT INTO schema_migrations (version) VALUES ('20171127195124'); +