Files
bl/help/server_show冠名索引修复.sql
昔念 dcbd9950d3
Some checks failed
ci/woodpecker/push/my-first-workflow Pipeline failed
1
2026-04-21 01:12:26 +08:00

19 lines
706 B
Go
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.

-- server_show 冠名索引修复
-- 目的
-- 1. 允许同一服务器存在多个不同玩家的冠名记录
-- 2. 保证同一玩家对同一服务器只有一条记录续费更新该记录
BEGIN;
-- 历史上 server_id 被建成了单列唯一约束/唯一索引会拦截同服多冠名
ALTER TABLE server_show DROP CONSTRAINT IF EXISTS idx_server_show_server_id;
DROP INDEX IF EXISTS idx_server_show_server_id;
-- 保留普通查询索引
CREATE INDEX IF NOT EXISTS idx_server_show_server_id ON server_show (server_id);
-- 保证一个玩家对一个服务器最多一条
CREATE UNIQUE INDEX IF NOT EXISTS idx_server_show_server_owner ON server_show (server_id, owner);
COMMIT;