diff --git a/db/migrate/20180913184128_fix_tag_prefix_index.rb b/db/migrate/20180913184128_fix_tag_prefix_index.rb new file mode 100644 index 000000000..f26799404 --- /dev/null +++ b/db/migrate/20180913184128_fix_tag_prefix_index.rb @@ -0,0 +1,7 @@ +class FixTagPrefixIndex < ActiveRecord::Migration[5.2] + def change + execute "set statement_timeout = 0" + execute "DROP INDEX index_tags_on_name_prefix" + 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)" + end +end