fix(duty): add unique keys for duty_day date and slot shift_type

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
zlwuandCursor committed 2026-08-14 17:08:22 +08:00
1 parent 931fd24671
commit 2502db7a02
1 file changed
+2 -1
@@ -17,7 +17,7 @@ CREATE TABLE IF NOT EXISTS `duty_day` (
`del_flag` smallint(6) NOT NULL DEFAULT '0' COMMENT '删除标志',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_token` (`access_token`),
KEY `idx_tenant_date` (`tenant_no`, `duty_date`, `del_flag`)
UNIQUE KEY `uk_tenant_duty_date` (`tenant_no`, `duty_date`, `del_flag`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='值班日(一天一条公开链接)';
CREATE TABLE IF NOT EXISTS `duty_slot` (
@@ -35,6 +35,7 @@ CREATE TABLE IF NOT EXISTS `duty_slot` (
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`del_flag` smallint(6) NOT NULL DEFAULT '0' COMMENT '删除标志',
PRIMARY KEY (`id`),
UNIQUE KEY `uk_day_shift` (`duty_day_id`, `shift_type`, `del_flag`),
KEY `idx_day` (`duty_day_id`, `del_flag`),
KEY `idx_tenant` (`tenant_no`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='值班班次名额';