2026-07-22 17:30:05 +08:00

19 lines
902 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.

SET NAMES utf8mb4 COLLATE utf8mb4_unicode_ci;
SET time_zone = '+00:00';
USE hyapp_wallet;
-- gift_configs 是礼物目录配置表而非送礼流水。新增列使用常量默认值MySQL 8 可原地完成,
-- 不扫描 wallet_transactions、wallet_entries 等高频大表,也不猜测历史 VIP 礼物等级。
SET @ddl := IF(
(SELECT COUNT(*) FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'gift_configs' AND COLUMN_NAME = 'vip_level') = 0,
'ALTER TABLE gift_configs ADD COLUMN vip_level INT NOT NULL DEFAULT 0 COMMENT ''VIP/贵族礼物对应的 VIP 等级,非 VIP 礼物为 0'' AFTER gift_type_code, ALGORITHM=INSTANT',
'SELECT 1'
);
PREPARE stmt FROM @ddl;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
-- 旧数据保持 0必须由运营在后台明确选择等级后保存根据价格、名称或排序自动回填都会制造错误权益。