fix(migration): 修复 000070 中 wallet_accounts 唯一索引单列残存导致的复合索引缺失问题

This commit is contained in:
yml2213
2026-09-08 13:30:52 +08:00
parent d178619fc7
commit 74ef817c41
@@ -38,6 +38,15 @@ PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @sql = IF(
(SELECT COUNT(*) FROM information_schema.STATISTICS WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'wallet_accounts' AND INDEX_NAME = 'uk_wallet_accounts_user_site') = 1,
'ALTER TABLE wallet_accounts DROP KEY uk_wallet_accounts_user_site',
'SELECT 1'
);
PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
SET @sql = IF(
(SELECT COUNT(*) FROM information_schema.STATISTICS WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'wallet_accounts' AND INDEX_NAME = 'uk_wallet_accounts_user_site') = 0,
'ALTER TABLE wallet_accounts ADD UNIQUE KEY uk_wallet_accounts_user_site (user_id, distribution_site_id)',