DROP TABLE IF EXISTS `payment_operation_log`;

CREATE TABLE `payment_operation_log` (
  `log_id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '日志ID',
  `order_id` BIGINT NULL COMMENT '订单ID（关联shop_order.order_id）',
  `status` TINYINT NOT NULL DEFAULT 1 COMMENT '操作状态（1成功 2失败）',
  `creator_id` BIGINT NOT NULL DEFAULT 0 COMMENT '创建者ID',
  `create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
  `updater_id` BIGINT NOT NULL DEFAULT 0 COMMENT '更新者ID',
  `update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  `remark` TEXT DEFAULT NULL COMMENT '操作备注',
  `deleted` TINYINT(1) NOT NULL DEFAULT 0 COMMENT '删除标志（0存在 1删除）',
  PRIMARY KEY (`log_id`),
  KEY `idx_create_time` (`create_time`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='支付操作日志表';

ALTER TABLE `payment_operation_log` 
ADD COLUMN `operation_type` VARCHAR(50) NULL DEFAULT '' COMMENT '操作类型' 
AFTER `status`;

ALTER TABLE `payment_operation_log` 
ADD COLUMN `params` TEXT DEFAULT NULL COMMENT '操作参数' 
AFTER `remark`;

ALTER TABLE `return_approval` 
ADD COLUMN `approval_time` DATETIME NULL DEFAULT CURRENT_TIMESTAMP COMMENT '审批时间' 
AFTER `status`;