2017-08-31 00:06:56 -04:00
|
|
|
class ShortenTopicCustomFieldsIndex < ActiveRecord::Migration[4.2]
|
2016-05-19 22:35:09 -04:00
|
|
|
def up
|
|
|
|
remove_index :topic_custom_fields, :value
|
|
|
|
add_index :topic_custom_fields, [:value, :name],
|
|
|
|
name: 'topic_custom_fields_value_key_idx',
|
|
|
|
where: 'value IS NOT NULL AND char_length(value) < 400'
|
|
|
|
end
|
|
|
|
def down
|
|
|
|
remove_index :topic_custom_fields, :value, name: 'topic_custom_fields_value_key_idx'
|
|
|
|
add_index :topic_custom_fields, :value
|
|
|
|
end
|
|
|
|
end
|