mirror of https://gitee.com/stylefeng/roses
112 lines
4.8 KiB
SQL
112 lines
4.8 KiB
SQL
|
|
-- ----------------------------
|
|
-- 订单库
|
|
-- ----------------------------
|
|
DROP DATABASE IF EXISTS `order`;
|
|
CREATE DATABASE IF NOT EXISTS `order` DEFAULT CHARSET utf8mb4 COLLATE utf8mb4_general_ci;
|
|
|
|
USE `order`;
|
|
|
|
DROP TABLE IF EXISTS `order_info`;
|
|
CREATE TABLE `order_info` (
|
|
`order_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '订单ID',
|
|
`product_id` bigint(20) NOT NULL COMMENT '商品ID',
|
|
`user_id` bigint(20) NOT NULL COMMENT '用户ID',
|
|
`prod_price` double(8, 2) NOT NULL COMMENT '商品单价',
|
|
`prod_number` int(11) NOT NULL COMMENT '商品数量',
|
|
`total_amount` double(10, 2) NOT NULL COMMENT '总价',
|
|
`pay_status` int(11) NOT NULL COMMENT '支付状态:1待支付,2已支付,3支付失败,已取消',
|
|
`create_user` bigint(20) NULL DEFAULT NULL COMMENT '创建者',
|
|
`create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
|
|
`update_user` bigint(20) NULL DEFAULT NULL COMMENT '更新者',
|
|
`update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
|
|
`remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',
|
|
PRIMARY KEY (`order_id`) USING BTREE
|
|
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '订单表' ROW_FORMAT = Dynamic;
|
|
|
|
DROP TABLE IF EXISTS `undo_log`;
|
|
CREATE TABLE `undo_log` (
|
|
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
|
`branch_id` bigint(20) NOT NULL,
|
|
`xid` varchar(100) NOT NULL,
|
|
`context` varchar(128) NOT NULL,
|
|
`rollback_info` longblob NOT NULL,
|
|
`log_status` int(11) NOT NULL,
|
|
`log_created` datetime NOT NULL,
|
|
`log_modified` datetime NOT NULL,
|
|
PRIMARY KEY (`id`),
|
|
UNIQUE KEY `ux_undo_log` (`xid`,`branch_id`)
|
|
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT = 'seata事务记录';
|
|
|
|
|
|
-- ----------------------------
|
|
-- 仓储库
|
|
-- ----------------------------
|
|
DROP DATABASE IF EXISTS `storage`;
|
|
CREATE DATABASE IF NOT EXISTS `storage` DEFAULT CHARSET utf8mb4 COLLATE utf8mb4_general_ci;
|
|
|
|
USE `storage`;
|
|
|
|
DROP TABLE IF EXISTS `product_info`;
|
|
CREATE TABLE `product_info` (
|
|
`prod_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '商品ID',
|
|
`prod_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '商品名称',
|
|
`inventory` int(11) NOT NULL COMMENT '库存数量',
|
|
`prod_price` double(8, 2) NOT NULL COMMENT '商品单价',
|
|
`prod_status` int(11) NOT NULL COMMENT '上架状态:1上架,2下架',
|
|
`create_user` bigint(20) NULL DEFAULT NULL COMMENT '创建者',
|
|
`create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
|
|
`update_user` bigint(20) NULL DEFAULT NULL COMMENT '更新者',
|
|
`update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
|
|
`remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',
|
|
PRIMARY KEY (`prod_id`) USING BTREE
|
|
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '商品表' ROW_FORMAT = Dynamic;
|
|
|
|
DROP TABLE IF EXISTS `undo_log`;
|
|
CREATE TABLE `undo_log` (
|
|
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
|
`branch_id` bigint(20) NOT NULL,
|
|
`xid` varchar(100) NOT NULL,
|
|
`context` varchar(128) NOT NULL,
|
|
`rollback_info` longblob NOT NULL,
|
|
`log_status` int(11) NOT NULL,
|
|
`log_created` datetime NOT NULL,
|
|
`log_modified` datetime NOT NULL,
|
|
PRIMARY KEY (`id`),
|
|
UNIQUE KEY `ux_undo_log` (`xid`,`branch_id`)
|
|
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT = 'seata事务记录';
|
|
|
|
|
|
-- ----------------------------
|
|
-- 用户库
|
|
-- ----------------------------
|
|
DROP DATABASE IF EXISTS `member`;
|
|
CREATE DATABASE IF NOT EXISTS `member` DEFAULT CHARSET utf8mb4 COLLATE utf8mb4_general_ci;
|
|
|
|
USE `member`;
|
|
|
|
DROP TABLE IF EXISTS `member_wallet`;
|
|
CREATE TABLE `member_wallet` (
|
|
`member_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '会员ID',
|
|
`member_balance` double(8, 2) DEFAULT '0.00' COMMENT '会员余额',
|
|
`member_integral` double(8, 2) DEFAULT '0.00' COMMENT '会员积分',
|
|
`create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
|
|
`update_user` bigint(20) NULL DEFAULT NULL COMMENT '更新者',
|
|
`update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
|
|
PRIMARY KEY (`member_id`) USING BTREE
|
|
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '用户钱包' ROW_FORMAT = Dynamic;
|
|
|
|
DROP TABLE IF EXISTS `undo_log`;
|
|
CREATE TABLE `undo_log` (
|
|
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
|
`branch_id` bigint(20) NOT NULL,
|
|
`xid` varchar(100) NOT NULL,
|
|
`context` varchar(128) NOT NULL,
|
|
`rollback_info` longblob NOT NULL,
|
|
`log_status` int(11) NOT NULL,
|
|
`log_created` datetime NOT NULL,
|
|
`log_modified` datetime NOT NULL,
|
|
PRIMARY KEY (`id`),
|
|
UNIQUE KEY `ux_undo_log` (`xid`,`branch_id`)
|
|
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT = 'seata事务记录';
|