Files
baiyue-firstleg/firstleg/src/main/resources/db/phase3-inbounded-status-unification.sql
T

21 lines
904 B
SQL
Raw Normal View History

2026-08-08 12:01:45 +08:00
-- WAIT_SPLIT 是二期当前有效终点。本脚本仅校验兼容结构,禁止改写主表或历史状态。
2026-08-07 19:40:42 +08:00
USE baiyue_firstleg;
2026-08-08 12:01:45 +08:00
DROP PROCEDURE IF EXISTS assert_wait_split_compatibility;
DELIMITER $$
CREATE PROCEDURE assert_wait_split_compatibility()
BEGIN
IF (SELECT COUNT(*) FROM information_schema.columns
WHERE table_schema = 'baiyue_firstleg' AND table_name = 'fl_inbound_order'
AND column_name = 'process_status') <> 1
OR (SELECT COUNT(*) FROM information_schema.columns
WHERE table_schema = 'baiyue_firstleg' AND table_name = 'fl_inbound_status_history'
AND column_name IN ('from_status', 'to_status')) <> 2 THEN
SIGNAL SQLSTATE '45000'
SET MESSAGE_TEXT = 'WAIT_SPLIT 兼容校验失败:入库状态字段不完整';
END IF;
END$$
DELIMITER ;
CALL assert_wait_split_compatibility();
DROP PROCEDURE assert_wait_split_compatibility;