Files
bl/help/约束类.sql

42 lines
1.2 KiB
Go
Raw Permalink Normal View History

-- 玩家+物品+VIP状态 联合唯一
ALTER TABLE player_item
ADD CONSTRAINT uk_player_item_player_item_vip
UNIQUE (player_id, item_id, is_vip);
-- 玩家+挖矿 联合唯一
CREATE UNIQUE INDEX uk_talk_player ON player_talk (talk_id, player_id);
-- 玩家+任务 联合唯一
CREATE UNIQUE INDEX uk_player_task ON player_task (player_id, task_id);
-- 玩家+称号 联合唯一
CREATE UNIQUE INDEX uk_player_title ON player_title (player_id, is_vip) WHERE deleted_at IS NULL;
-- 玩家+精灵 联合唯一
CREATE UNIQUE INDEX uk_player_pet ON player_pet (player_id, is_vip, catch_time) WHERE deleted_at IS NULL;
-- 玩家+CDK 联合唯一
CREATE UNIQUE INDEX uk_player_cdk_log
ON player_cdk_log (player_id, code_id, is_vip)
WHERE deleted_at IS NULL;
-- 玩家孵蛋 联合唯一
CREATE UNIQUE INDEX uk_player_egg
ON player_egg (player_id, is_vip)
WHERE deleted_at IS NULL;
---PVP索引
CREATE UNIQUE INDEX uk_player_pvp
ON player_pvp (player_id, season)
WHERE deleted_at IS NULL;
--签到
CREATE UNIQUE INDEX uk_player_sign_in_log
ON player_sign_in_log (player_id, sign_in_id, is_vip)
WHERE deleted_at IS NULL;
--房间索引
CREATE UNIQUE INDEX uk_player_room_house
ON player_room_house (player_id, is_vip)
WHERE deleted_at IS NULL;