feat(db): add migrations for RBAC, diagnostic, messaging, attendance, leave, invitation codes

- 0011: RBAC role flags and seed data

- 0012: diagnostic grade_id

- 0013: message recall

- 0014: message templates

- 0015: group messages and message reports/blocks

- 0016: invitation codes

- 0017: draft device sync

- 0018: attendance status reason

- 0019: attendance warning thresholds

- 0020: leave requests

- 0021: attendance period
This commit is contained in:
SpecialX
2026-07-03 10:23:24 +08:00
parent 48829bd02b
commit 365c36d97b
13 changed files with 308 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
-- 0021_attendance_period.sql
-- L-6 节次考勤:为 attendance_records 表添加 period 字段。
--
-- 节次枚举:
-- morning_reading 早读
-- morning 上午
-- afternoon 下午
-- evening 晚自习
-- full_day 全日默认值向后兼容null 也表示全日)
--
-- 向后兼容策略:
-- - 新增 period 列为 NULLABLE已有数据保持 NULL视为 full_day
-- - 新记录由应用层显式写入 period未指定时写入 'full_day'
-- - 查询层 period IS NULL OR period = 'full_day' 均视为全日记录
ALTER TABLE `attendance_records`
ADD COLUMN `period` ENUM('morning_reading','morning','afternoon','evening','full_day') NULL DEFAULT NULL AFTER `date`;
-- 复合索引:班级 + 日期 + 节次,支持按节次查询班级当日点名
CREATE INDEX `attendance_records_class_date_period_idx` ON `attendance_records` (`class_id`, `date`, `period`);