Files
zt-closet-backend/pkg/migration/000009_create_refund_flow_logs.up.sql
T
2026-09-11 01:41:52 +08:00

26 lines
1.9 KiB
SQL

CREATE TABLE `refund_flow_logs` (
`id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`created_at` BIGINT NOT NULL DEFAULT 0 COMMENT '创建时间',
`updated_at` BIGINT NOT NULL DEFAULT 0 COMMENT '更新时间',
`deleted_at` BIGINT NOT NULL DEFAULT 0 COMMENT '删除时间(0 表示未删除)',
`created_by` BIGINT NOT NULL DEFAULT 0 COMMENT '创建人',
`updated_by` BIGINT NOT NULL DEFAULT 0 COMMENT '更新人',
`deleted_by` BIGINT NOT NULL DEFAULT 0 COMMENT '删除人',
`order_id` BIGINT NOT NULL DEFAULT 0 COMMENT '关联订单ID',
`order_no` VARCHAR(64) NOT NULL DEFAULT '' COMMENT '商户订单号(冗余,方便查询)',
`user_id` BIGINT NOT NULL DEFAULT 0 COMMENT '用户ID(冗余,方便按用户查)',
`refund_no` VARCHAR(64) NOT NULL DEFAULT '' COMMENT '商户退款单号',
`wechat_refund_no` VARCHAR(64) NOT NULL DEFAULT '' COMMENT '微信退款单号',
`refund_amount` BIGINT NOT NULL DEFAULT 0 COMMENT '本次退款金额(分)',
`refund_reason` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '退款原因',
`status` TINYINT NOT NULL DEFAULT 0 COMMENT '退款状态 0=待处理 1=退款中 2=退款成功 3=退款失败',
`apply_time` BIGINT NOT NULL DEFAULT 0 COMMENT '申请时间',
`success_time` BIGINT NOT NULL DEFAULT 0 COMMENT '退款成功时间',
`fail_reason` VARCHAR(255) NOT NULL DEFAULT '' COMMENT '失败原因',
`callback_raw` TEXT COMMENT '微信退款回调原始报文',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_refund_flow_no` (`refund_no`),
KEY `idx_refund_flow_order` (`order_id`),
KEY `idx_refund_flow_user` (`user_id`)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COMMENT = '退款流水日志表';