Files
my-mom-system/prd/db/alter_md_bom_add_item_spec.sql
panchengyong c28ada5050 commit content
2026-03-06 02:02:59 +08:00

20 lines
672 B
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.
-- ============================================================
-- 为 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;