Files
gochat/backend/migrations/000067_translate_default_custom_priority.down.sql
T

28 lines
852 B
SQL

UPDATE custom_attribute_definitions
SET
attribute_display_name = 'Custom Priority',
description = 'Custom ticket priority',
attribute_values = '["Low", "Medium", "High"]'::jsonb,
updated_at = CURRENT_TIMESTAMP
WHERE attribute_name = 'custom_priority'
AND attribute_model = 'conversation_attribute'
AND attribute_display_name = '自定义优先级'
AND description = '自定义工单优先级'
AND attribute_values = '["低", "中", "高"]'::jsonb;
UPDATE conversations
SET
custom_attributes = jsonb_set(
custom_attributes,
'{custom_priority}',
to_jsonb(
CASE custom_attributes->>'custom_priority'
WHEN '低' THEN 'Low'
WHEN '中' THEN 'Medium'
WHEN '高' THEN 'High'
END
)
),
updated_at = CURRENT_TIMESTAMP
WHERE custom_attributes->>'custom_priority' IN ('低', '中', '高');