commit content
This commit is contained in:
19
prd/db/alter_md_bom_add_item_spec.sql
Normal file
19
prd/db/alter_md_bom_add_item_spec.sql
Normal file
@@ -0,0 +1,19 @@
|
||||
-- ============================================================
|
||||
-- 为 md_bom 表添加 item_spec 字段
|
||||
-- 说明: 修复字段缺失问题,item_spec作为冗余字段存储产品物料规格
|
||||
-- 生成日期: 2026-01-26
|
||||
-- 兼容 MySQL 5.7+
|
||||
-- ============================================================
|
||||
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
-- 添加 item_spec 字段
|
||||
ALTER TABLE `md_bom`
|
||||
ADD COLUMN `item_spec` varchar(200) DEFAULT NULL COMMENT '产品物料规格 (冗余字段)'
|
||||
AFTER `item_name`;
|
||||
|
||||
-- 更新现有数据:从md_item表同步item_spec
|
||||
UPDATE `md_bom` b
|
||||
INNER JOIN `md_item` i ON b.item_id = i.item_id
|
||||
SET b.item_spec = i.specification
|
||||
WHERE b.item_spec IS NULL;
|
||||
Reference in New Issue
Block a user