add prefix index on tags (#3858)

This commit is contained in:
Albert Yi
2018-09-12 14:01:21 -07:00
parent f487b2a2c6
commit 8c564f055f
3 changed files with 16 additions and 3 deletions

View File

@@ -0,0 +1,5 @@
class AddPrefixesToTags < ActiveRecord::Migration[5.2]
def change
execute "CREATE INDEX index_tags_on_name_prefix ON tags USING gin (REGEXP_REPLACE(name, '([a-z0-9])[a-z0-9'']*($|[^a-z0-9'']+)', '\1', 'g') gin_trgm_ops) WHERE post_count > 0"
end
end