refactor: 统一数据库约束维护位置
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
-- server_show 冠名索引修复
|
||||
-- 目的:
|
||||
-- 1. 允许同一服务器存在多个不同玩家的冠名记录
|
||||
-- 2. 保证同一玩家对同一服务器只有一条记录(续费更新该记录)
|
||||
-- 目的:允许同一服务器存在多个不同玩家的冠名记录。
|
||||
-- 同服同属主唯一约束统一在 约束类.sql 中维护。
|
||||
|
||||
BEGIN;
|
||||
|
||||
@@ -12,12 +11,4 @@ DROP INDEX IF EXISTS idx_server_show_server_id;
|
||||
-- 保留普通查询索引
|
||||
CREATE INDEX IF NOT EXISTS idx_server_show_server_id ON server_show (server_id);
|
||||
|
||||
-- 保证“一个玩家对一个服务器最多一条”
|
||||
ALTER TABLE server_show DROP CONSTRAINT IF EXISTS idx_server_show_server_owner;
|
||||
DROP INDEX IF EXISTS idx_server_show_server_owner;
|
||||
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS idx_server_show_server_owner
|
||||
ON server_show (server_id, owner)
|
||||
WHERE deleted_at IS NULL;
|
||||
|
||||
COMMIT;
|
||||
|
||||
Reference in New Issue
Block a user