优化邮编分区管理,新增匹配类型字段及相关逻辑
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
-- prc_zone_detail.match_type: FULL exact / PREFIX starts-with
|
||||
-- Idempotent. Column default is FULL. No bulk rewrite of existing rows.
|
||||
|
||||
SET @db := DATABASE();
|
||||
|
||||
SELECT COUNT(*) INTO @col_match_type
|
||||
FROM information_schema.COLUMNS
|
||||
WHERE TABLE_SCHEMA = @db AND TABLE_NAME = 'prc_zone_detail' AND COLUMN_NAME = 'match_type';
|
||||
|
||||
SET @sql := IF(@col_match_type = 0,
|
||||
'ALTER TABLE prc_zone_detail ADD COLUMN match_type varchar(16) NOT NULL DEFAULT ''FULL'' COMMENT ''FULL exact match / PREFIX starts with'' AFTER postcode',
|
||||
'SELECT 1');
|
||||
PREPARE stmt FROM @sql; EXECUTE stmt; DEALLOCATE PREPARE stmt;
|
||||
@@ -0,0 +1,7 @@
|
||||
-- One-shot: undo earlier mistaken "all rows = PREFIX" migration.
|
||||
-- Default display/billing type becomes FULL.
|
||||
-- After running, re-import Evri / UK / Canada remote sheets if those need PREFIX.
|
||||
|
||||
UPDATE prc_zone_detail
|
||||
SET match_type = 'FULL'
|
||||
WHERE match_type IS NULL OR match_type = '' OR UPPER(match_type) = 'PREFIX';
|
||||
Reference in New Issue
Block a user