forked from lunanting/cangku
17 lines
646 B
SQL
17 lines
646 B
SQL
-- Run once against an existing planning MySQL/MariaDB database before deployment.
|
|
SET @sku_fingerprint_exists = (
|
|
SELECT COUNT(*)
|
|
FROM information_schema.columns
|
|
WHERE table_schema = DATABASE()
|
|
AND table_name = 'alibaba_1688_products'
|
|
AND column_name = 'sku_fingerprint'
|
|
);
|
|
SET @add_sku_fingerprint_sql = IF(
|
|
@sku_fingerprint_exists = 0,
|
|
'ALTER TABLE alibaba_1688_products ADD COLUMN sku_fingerprint CHAR(64) NULL COMMENT ''有序 SKU 规格指纹'' AFTER sku_count',
|
|
'SELECT 1'
|
|
);
|
|
PREPARE add_sku_fingerprint_stmt FROM @add_sku_fingerprint_sql;
|
|
EXECUTE add_sku_fingerprint_stmt;
|
|
DEALLOCATE PREPARE add_sku_fingerprint_stmt;
|