1
Some checks failed
ci/woodpecker/push/my-first-workflow Pipeline failed

This commit is contained in:
昔念
2026-04-21 01:12:26 +08:00
parent 4b42a64da0
commit dcbd9950d3
5 changed files with 105 additions and 6 deletions

View File

@@ -0,0 +1,18 @@
-- 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;