2019-05-02 18:17:27 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
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,
|
|
|
|
%i[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
|