-- 为jd_order表添加退款相关字段
-- 执行日期：2025-01-XX

ALTER TABLE jd_order 
ADD COLUMN is_refunded INT DEFAULT 0 COMMENT '是否退款（0否 1是）',
ADD COLUMN refund_date DATETIME NULL COMMENT '退款日期',
ADD COLUMN is_refund_received INT DEFAULT 0 COMMENT '是否退款到账（0否 1是）',
ADD COLUMN refund_received_date DATETIME NULL COMMENT '退款到账日期',
ADD COLUMN is_rebate_received INT DEFAULT 0 COMMENT '后返到账（0否 1是）',
ADD COLUMN rebate_received_date DATETIME NULL COMMENT '后返到账日期';

-- 添加索引（可选，根据查询需求）
-- CREATE INDEX idx_is_refunded ON jd_order(is_refunded);
-- CREATE INDEX idx_is_refund_received ON jd_order(is_refund_received);
-- CREATE INDEX idx_is_rebate_received ON jd_order(is_rebate_received);

