mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-24 22:29:19 +08:00
refactor: 去掉订单明细/SKU成本/影响面冗余 product_id,归属经 sku 关联
This commit is contained in:
@@ -111,8 +111,7 @@ CREATE TABLE `ec_product_sku` (
|
||||
CREATE TABLE `ec_product_sku_cost` (
|
||||
`id` bigint UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||||
`company_id` bigint UNSIGNED NOT NULL COMMENT '公司ID',
|
||||
`product_id` bigint UNSIGNED NOT NULL COMMENT '商品ID(冗余,便于按商品查)',
|
||||
`sku_id` bigint UNSIGNED NOT NULL COMMENT 'SKU ID',
|
||||
`sku_id` bigint UNSIGNED NOT NULL COMMENT 'SKU ID(商品归属经 ec_product_sku.product_id)',
|
||||
`product_cost` decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '商品成本',
|
||||
`shipping_cost` decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '运费成本',
|
||||
`other_cost` decimal(10, 2) NOT NULL DEFAULT 0.00 COMMENT '其他成本',
|
||||
@@ -125,12 +124,10 @@ CREATE TABLE `ec_product_sku_cost` (
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
UNIQUE INDEX `uk_ec_product_sku_cost_sku_from`(`sku_id` ASC, `effective_from` ASC) USING BTREE,
|
||||
INDEX `idx_ec_product_sku_cost_company`(`company_id` ASC) USING BTREE,
|
||||
INDEX `idx_ec_product_sku_cost_product`(`product_id` ASC) USING BTREE,
|
||||
INDEX `idx_ec_product_sku_cost_from`(`effective_from` ASC) USING BTREE,
|
||||
INDEX `fk_ec_product_sku_cost_creator`(`create_by` ASC) USING BTREE,
|
||||
INDEX `fk_ec_product_sku_cost_updater`(`update_by` ASC) USING BTREE,
|
||||
CONSTRAINT `fk_ec_product_sku_cost_company` FOREIGN KEY (`company_id`) REFERENCES `org_company` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_ec_product_sku_cost_product` FOREIGN KEY (`product_id`) REFERENCES `ec_product` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_ec_product_sku_cost_sku` FOREIGN KEY (`sku_id`) REFERENCES `ec_product_sku` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_ec_product_sku_cost_creator` FOREIGN KEY (`create_by`) REFERENCES `sys_user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE,
|
||||
CONSTRAINT `fk_ec_product_sku_cost_updater` FOREIGN KEY (`update_by`) REFERENCES `sys_user` (`id`) ON DELETE SET NULL ON UPDATE CASCADE
|
||||
|
||||
Reference in New Issue
Block a user