java-mall/sql/shop/dev/20250929_ddl.sql
2025-10-11 14:22:08 +08:00

13 lines
1.3 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 `product_quantity_consumption` (
`consume_id` varchar(32) NOT NULL COMMENT '自定义主键ID',
`product_number` varchar(50) NOT NULL COMMENT '商品编号',
`order_id` varchar(50) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT '' COMMENT '订单编号',
`quantity` decimal(15,3) NOT NULL COMMENT '数量(正数表示入库/增加,负数表示出库/减少)',
`status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '消费状态0-未消费1-已消费',
`store_id` int(20) NOT NULL COMMENT '店铺ID',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (`consume_id`),
KEY `idx_shop_product` (`store_id`, `product_number`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='商品数量消费表';