Change hashtags to preserve first-used casing (#11416)
This commit is contained in:
parent
4cc29eb5ad
commit
f371b32137
6 changed files with 54 additions and 19 deletions
|
@ -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
|
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 2019_07_15_164535) do
|
||||
ActiveRecord::Schema.define(version: 2019_07_26_175042) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
@ -652,8 +652,7 @@ ActiveRecord::Schema.define(version: 2019_07_15_164535) do
|
|||
t.string "name", default: "", null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index "lower((name)::text) text_pattern_ops", name: "hashtag_search_index"
|
||||
t.index ["name"], name: "index_tags_on_name", unique: true
|
||||
t.index "lower((name)::text)", name: "index_tags_on_name_lower", unique: true
|
||||
end
|
||||
|
||||
create_table "tombstones", force: :cascade do |t|
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue