shop-back-end/sql/20250703.sql

24 lines
1.6 KiB
SQL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

CREATE TABLE `user_balance_record` (
`balance_record_id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`ab98_user_id` bigint NOT NULL COMMENT '汇邦云用户唯一ID',
`openid` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'openid',
`transaction_type` tinyint NOT NULL COMMENT '交易类型1充值 2消费 3退款',
`use_record_id` bigint NULL COMMENT '消费或退款时使用的充值id',
`amount` int NOT NULL COMMENT '交易金额,单位分',
`status` tinyint NOT NULL DEFAULT 0 COMMENT '交易状态0未完成 1成功 2失败',
`trade_id` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '支付网关交易id',
`biz_order_id` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '业务系统订单ID对接外部系统',
`creator_id` bigint DEFAULT 0 COMMENT '创建者ID',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater_id` bigint DEFAULT 0 COMMENT '更新者ID',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` tinyint(1) NOT NULL DEFAULT '0' COMMENT '删除标志0存在 1删除',
PRIMARY KEY (`balance_record_id`),
KEY `idx_ab98_user_id` (`ab98_user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='用户余额交易记录表';
ALTER TABLE `ab98_user`
ADD COLUMN `ab98_balance` INT NOT NULL DEFAULT 0 COMMENT '用户余额(单位:分)';
ALTER TABLE `user_balance_record`
ADD COLUMN `remain_amount` INT NOT NULL DEFAULT 0 COMMENT '本次充值剩余余额(单位:分)';