mirror of
https://github.com/discourse/discourse.git
synced 2024-11-29 04:03:57 -06:00
16 lines
505 B
Ruby
16 lines
505 B
Ruby
# frozen_string_literal: true
|
|
|
|
class ShortenTopicCustomFieldsIndex < ActiveRecord::Migration[4.2]
|
|
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
|