修复仓库内部编号增量迁移

This commit is contained in:
2026-09-09 17:55:46 +08:00
parent fc5ce1f45f
commit 4fee718424
@@ -866,6 +866,20 @@ CREATE TABLE IF NOT EXISTS wh_warehouse (
KEY idx_wh_country (tenant_id, country_code, deleted)
) ENGINE=InnoDB COMMENT='平台公共仓库主数据表:统一归属平台作用域 tenant_id=0';
SET @warehouse_internal_code_ddl = IF(
EXISTS(
SELECT 1 FROM information_schema.columns
WHERE table_schema = 'baiyue_warehouse'
AND table_name = 'wh_warehouse'
AND column_name = 'internal_code'
),
'SELECT 1',
'ALTER TABLE wh_warehouse ADD COLUMN internal_code VARCHAR(16) NULL COMMENT ''FBA内部编号,仅FBA仓可配置'' AFTER warehouse_code'
);
PREPARE warehouse_internal_code_statement FROM @warehouse_internal_code_ddl;
EXECUTE warehouse_internal_code_statement;
DEALLOCATE PREPARE warehouse_internal_code_statement;
CREATE TABLE IF NOT EXISTS wh_warehouse_address (
id BIGINT UNSIGNED NOT NULL COMMENT '仓库地址ID',
tenant_id BIGINT UNSIGNED NOT NULL COMMENT '平台公共仓库地址固定使用 tenant_id=0',