admin/sql/migrate_order_export_qualification_id.sql
zzh ddb8efba15
All checks were successful
Build and Deploy / deploy (push) Successful in 58s
feat: 9610汇总下单关联出口资质,并补齐批量模板字段
下单/导入在 9610Summary 时校验并落库 ExportQualificationId(可回落默认备案),写入 9610 申报企业信息;专线小包模板长宽高改必填并增加资质备案列。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-24 16:12:39 +08:00

25 lines
719 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.

-- 存量库:t_order 增加出口资质备案 Id(9610Summary 选用)
-- 可重复执行。
SET @db := DATABASE();
SET @exists := (
SELECT COUNT(1)
FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA = @db
AND TABLE_NAME = 't_order'
AND COLUMN_NAME = 'ExportQualificationId'
);
SET @sql := IF(
@exists = 0,
'ALTER TABLE `t_order`
ADD COLUMN `ExportQualificationId` INT NULL COMMENT ''出口资质备案 Id(t_customer_export_qualification.Id)'' AFTER `ExportCustomsMode`,
ADD KEY `idx_order_export_qualification` (`ExportQualificationId`)',
'SELECT ''t_order.ExportQualificationId already exists'' AS info'
);
PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;