fix phase3 phase4 development acceptance blockers
This commit is contained in:
@@ -484,6 +484,7 @@ CREATE TABLE IF NOT EXISTS ll_order_detail (
|
||||
|
||||
CREATE TABLE IF NOT EXISTS ll_loading_order_status_history (
|
||||
id BIGINT NOT NULL AUTO_INCREMENT COMMENT '状态历史主键',
|
||||
customer_id VARCHAR(128) NOT NULL COMMENT '客户数据隔离键',
|
||||
order_id BIGINT NOT NULL COMMENT '尾程订单ID',
|
||||
from_status VARCHAR(32) NULL COMMENT '变更前状态',
|
||||
to_status VARCHAR(32) NOT NULL COMMENT '变更后状态',
|
||||
@@ -491,7 +492,7 @@ CREATE TABLE IF NOT EXISTS ll_loading_order_status_history (
|
||||
remark VARCHAR(500) NULL COMMENT '状态变更备注',
|
||||
created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '记录时间',
|
||||
PRIMARY KEY (id),
|
||||
KEY idx_ll_loading_history_order (order_id,created_at)
|
||||
KEY idx_ll_loading_history_customer_order (customer_id,order_id,created_at)
|
||||
) ENGINE=InnoDB COMMENT='尾程订单状态变更历史';
|
||||
|
||||
-- Existing order installations: add transfer fields without replacing row data.
|
||||
@@ -3685,6 +3686,20 @@ SET @ddl = (SELECT IF(EXISTS (SELECT 1 FROM information_schema.statistics WHERE
|
||||
AND table_name='ll_local_looseboard_order' AND index_name='uk_ll_local_looseboard_lastleg'), 'SELECT 1',
|
||||
'ALTER TABLE ll_local_looseboard_order ADD UNIQUE KEY uk_ll_local_looseboard_lastleg(lastleg_order_id)'));
|
||||
PREPARE phase4_looseboard_tail_030 FROM @ddl; EXECUTE phase4_looseboard_tail_030; DEALLOCATE PREPARE phase4_looseboard_tail_030;
|
||||
SET @ddl = (SELECT IF(EXISTS (SELECT 1 FROM information_schema.columns WHERE table_schema=DATABASE()
|
||||
AND table_name='ll_loading_order_status_history' AND column_name='customer_id'), 'SELECT 1',
|
||||
'ALTER TABLE ll_loading_order_status_history ADD COLUMN customer_id VARCHAR(128) NULL COMMENT ''客户数据隔离键'' AFTER id'));
|
||||
PREPARE phase4_loading_history_customer_030 FROM @ddl; EXECUTE phase4_loading_history_customer_030; DEALLOCATE PREPARE phase4_loading_history_customer_030;
|
||||
UPDATE ll_loading_order_status_history history
|
||||
JOIN ll_order orders ON orders.id=history.order_id
|
||||
SET history.customer_id=orders.customer_id
|
||||
WHERE history.customer_id IS NULL;
|
||||
ALTER TABLE ll_loading_order_status_history
|
||||
MODIFY COLUMN customer_id VARCHAR(128) NOT NULL COMMENT '客户数据隔离键';
|
||||
SET @ddl = (SELECT IF(EXISTS (SELECT 1 FROM information_schema.statistics WHERE table_schema=DATABASE()
|
||||
AND table_name='ll_loading_order_status_history' AND index_name='idx_ll_loading_history_customer_order'), 'SELECT 1',
|
||||
'ALTER TABLE ll_loading_order_status_history ADD KEY idx_ll_loading_history_customer_order(customer_id,order_id,created_at)'));
|
||||
PREPARE phase4_loading_history_customer_030 FROM @ddl; EXECUTE phase4_loading_history_customer_030; DEALLOCATE PREPARE phase4_loading_history_customer_030;
|
||||
|
||||
-- ============================================================================
|
||||
-- 2026-08-20 / 029
|
||||
|
||||
Reference in New Issue
Block a user