-- Active: xiaoding_test@@192.168.110.85@3306@xiaoding_test
/* 
 * 在order表中增加字段
 */
ALTER TABLE `order`
    /* 支付相关字段 */
    ADD COLUMN `payment_method` varchar(50) COMMENT '支付方式' AFTER `total_amount`,
    ADD COLUMN `payment_time` timestamp NULL COMMENT '支付时间' AFTER `payment_method`,
    
    /* 营销相关字段 */
    ADD COLUMN `marketing_type` varchar(50) COMMENT '营销类型' AFTER `order_source`,
    ADD COLUMN `bargain_amount` decimal(10,2) DEFAULT 0.00 COMMENT '砍价减免金额' AFTER `marketing_type`,
    ADD COLUMN `reward_amount` decimal(10,2) DEFAULT 0.00 COMMENT '打赏金额' AFTER `bargain_amount`,
    ADD COLUMN `bounty_amount` decimal(10,2) DEFAULT 0.00 COMMENT '悬赏金额' AFTER `reward_amount`,
    
    /* 加钟订单关联字段 */
    ADD COLUMN `parent_order_id` bigint unsigned NULL COMMENT '上级订单ID' AFTER `id`,
    ADD INDEX `idx_parent_order_id` (`parent_order_id`),
    
    /* 服务完成相关时间字段 */
    ADD COLUMN `user_leave_time` timestamp NULL COMMENT '用户确认撤离时间' AFTER `service_time`,
    ADD COLUMN `coach_leave_time` timestamp NULL COMMENT '技师确认离开时间' AFTER `user_leave_time`;

ALTER TABLE `order`
    /* 服务时间相关字段 */
    ADD COLUMN `arrival_time` timestamp NULL COMMENT '到达时间' AFTER `service_time`,
    ADD COLUMN `service_start_time` timestamp NULL COMMENT '开始服务时间' AFTER `arrival_time`,
    ADD COLUMN `user_leave_time` timestamp NULL COMMENT '用户确认撤离时间' AFTER `service_start_time`;