Files
dafuweng-saiadmin6.x/server/db/dice_player_dept_username_unique.sql
2026-05-26 09:43:42 +08:00

11 lines
548 B
SQL
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.
-- dice_player同一渠道内用户名唯一dept_id + username— 数据库根本约束
-- 执行前请备份;若存在重复数据需先清理后再执行
-- 推荐php db/run_dice_player_dept_username_unique.php
-- 移除仅按 username 的普通索引(若不存在可忽略报错)
-- ALTER TABLE `dice_player` DROP INDEX `idx_dice_player_username`;
-- 同一渠道下用户名唯一UNIQUE 为数据库层最终约束)
ALTER TABLE `dice_player`
ADD UNIQUE INDEX `uk_dice_player_dept_username` (`dept_id`, `username`);