20170606113804_change_tag_search_index_to_btree.rb 390 B

1234567891011
  1. class ChangeTagSearchIndexToBtree < ActiveRecord::Migration[5.1]
  2. def up
  3. remove_index :tags, name: :hashtag_search_index
  4. execute 'CREATE INDEX hashtag_search_index ON tags (name text_pattern_ops);'
  5. end
  6. def down
  7. remove_index :tags, name: :hashtag_search_index
  8. execute 'CREATE INDEX hashtag_search_index ON tags USING gin(to_tsvector(\'simple\', tags.name));'
  9. end
  10. end