You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

15 lines
585 B

  1. class AddCaseInsensitiveIndexToTags < ActiveRecord::Migration[5.2]
  2. disable_ddl_transaction!
  3. def up
  4. safety_assured { execute 'CREATE UNIQUE INDEX CONCURRENTLY index_tags_on_name_lower ON tags (lower(name))' }
  5. remove_index :tags, name: 'index_tags_on_name'
  6. remove_index :tags, name: 'hashtag_search_index'
  7. end
  8. def down
  9. add_index :tags, :name, unique: true, algorithm: :concurrently
  10. safety_assured { execute 'CREATE INDEX CONCURRENTLY hashtag_search_index ON tags (name text_pattern_ops)' }
  11. remove_index :tags, name: 'index_tags_on_name_lower'
  12. end
  13. end