-- +goose Up

-- 摸大红订单支持多商品：商品行快照（兼容旧单：无 items 时仍读 product_snapshot）
ALTER TABLE mohong_orders
  ADD COLUMN items_snapshot JSON NULL COMMENT '订单商品行快照[{product_id,title,quantity,unit_price_cent,...}]' AFTER product_snapshot;

UPDATE system_configs
SET `value` = '【摸大红订单】\n订单号：{{order_no}}\n下单时间：{{created_at}}\n商品明细：\n{{items}}\n数量合计：{{quantity}}\n金额：{{amount}}\n下单人：{{buyer_name}}（{{buyer_phone}}）',
    description = '摸大红订单一键复制文案模板（支持多商品 {{items}}）'
WHERE `key` = 'mohong.order_copy_template'
  AND (`value` LIKE '%商品：{{product_title}}%' OR `value` = '');

-- +goose Down

ALTER TABLE mohong_orders DROP COLUMN items_snapshot;
