All checks were successful
Build and Deploy / deploy (push) Successful in 1m0s
库内 SKU 与 createOrderOne items 对齐 productId/nonStdProductId/stdProductId;无值时仍序列化为 null。 Co-authored-by: Cursor <cursoragent@cursor.com>
56 lines
1.5 KiB
SQL
56 lines
1.5 KiB
SQL
-- c_sku:新增产品标识编码 / 非标产品标识编码 / 标准产品标识编码(对齐订单申报明细)。
|
||
-- 可重复执行。
|
||
|
||
SET @db := DATABASE();
|
||
|
||
-- c_sku.ProductId
|
||
SET @exists := (
|
||
SELECT COUNT(1)
|
||
FROM information_schema.COLUMNS
|
||
WHERE TABLE_SCHEMA = @db
|
||
AND TABLE_NAME = 'c_sku'
|
||
AND COLUMN_NAME = 'ProductId'
|
||
);
|
||
SET @sql := IF(
|
||
@exists = 0,
|
||
'ALTER TABLE `c_sku` ADD COLUMN `ProductId` VARCHAR(100) NULL COMMENT ''产品标识编码'' AFTER `DeclareElement`',
|
||
'SELECT ''c_sku.ProductId already exists'' AS info'
|
||
);
|
||
PREPARE stmt FROM @sql;
|
||
EXECUTE stmt;
|
||
DEALLOCATE PREPARE stmt;
|
||
|
||
-- c_sku.NonStdProductId
|
||
SET @exists := (
|
||
SELECT COUNT(1)
|
||
FROM information_schema.COLUMNS
|
||
WHERE TABLE_SCHEMA = @db
|
||
AND TABLE_NAME = 'c_sku'
|
||
AND COLUMN_NAME = 'NonStdProductId'
|
||
);
|
||
SET @sql := IF(
|
||
@exists = 0,
|
||
'ALTER TABLE `c_sku` ADD COLUMN `NonStdProductId` VARCHAR(100) NULL COMMENT ''非标产品标识编码'' AFTER `ProductId`',
|
||
'SELECT ''c_sku.NonStdProductId already exists'' AS info'
|
||
);
|
||
PREPARE stmt FROM @sql;
|
||
EXECUTE stmt;
|
||
DEALLOCATE PREPARE stmt;
|
||
|
||
-- c_sku.StdProductId
|
||
SET @exists := (
|
||
SELECT COUNT(1)
|
||
FROM information_schema.COLUMNS
|
||
WHERE TABLE_SCHEMA = @db
|
||
AND TABLE_NAME = 'c_sku'
|
||
AND COLUMN_NAME = 'StdProductId'
|
||
);
|
||
SET @sql := IF(
|
||
@exists = 0,
|
||
'ALTER TABLE `c_sku` ADD COLUMN `StdProductId` VARCHAR(100) NULL COMMENT ''标准产品标识编码'' AFTER `NonStdProductId`',
|
||
'SELECT ''c_sku.StdProductId already exists'' AS info'
|
||
);
|
||
PREPARE stmt FROM @sql;
|
||
EXECUTE stmt;
|
||
DEALLOCATE PREPARE stmt;
|