0
0
Fork 0

Change hashtags to preserve first-used casing (#11416)

This commit is contained in:
Eugen Rochko 2019-07-28 05:59:51 +02:00 committed by GitHub
parent 4cc29eb5ad
commit f371b32137
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 54 additions and 19 deletions

View file

@ -0,0 +1,15 @@
class AddCaseInsensitiveIndexToTags < ActiveRecord::Migration[5.2]
disable_ddl_transaction!
def up
safety_assured { execute 'CREATE UNIQUE INDEX CONCURRENTLY index_tags_on_name_lower ON tags (lower(name))' }
remove_index :tags, name: 'index_tags_on_name'
remove_index :tags, name: 'hashtag_search_index'
end
def down
add_index :tags, :name, unique: true, algorithm: :concurrently
safety_assured { execute 'CREATE INDEX CONCURRENTLY hashtag_search_index ON tags (name text_pattern_ops)' }
remove_index :tags, name: 'index_tags_on_name_lower'
end
end