feat: 初始化考培练系统项目
- 从服务器拉取完整代码 - 按框架规范整理项目结构 - 配置 Drone CI 测试环境部署 - 包含后端(FastAPI)、前端(Vue3)、管理端 技术栈: Vue3 + TypeScript + FastAPI + MySQL
This commit is contained in:
36
backend/scripts/alter_exams_add_rounds.sql
Normal file
36
backend/scripts/alter_exams_add_rounds.sql
Normal file
@@ -0,0 +1,36 @@
|
||||
-- 增量脚本:为exams表增加三轮得分字段
|
||||
-- 创建时间:2025-10-12
|
||||
-- 说明:简化三轮考试机制,一条考试记录存储三轮得分
|
||||
|
||||
USE kaopeilian;
|
||||
|
||||
-- 1. 为exams表增加三轮得分字段
|
||||
ALTER TABLE exams
|
||||
ADD COLUMN round1_score FLOAT NULL COMMENT '第一轮得分' AFTER score,
|
||||
ADD COLUMN round2_score FLOAT NULL COMMENT '第二轮得分' AFTER round1_score,
|
||||
ADD COLUMN round3_score FLOAT NULL COMMENT '第三轮得分' AFTER round2_score;
|
||||
|
||||
-- 2. 为已存在的考试记录设置默认值(将score复制到round1_score)
|
||||
UPDATE exams
|
||||
SET round1_score = score
|
||||
WHERE score IS NOT NULL AND round1_score IS NULL;
|
||||
|
||||
-- 3. 验证结果
|
||||
SELECT
|
||||
COUNT(*) as total_exams,
|
||||
COUNT(round1_score) as has_round1,
|
||||
COUNT(round2_score) as has_round2,
|
||||
COUNT(round3_score) as has_round3
|
||||
FROM exams;
|
||||
|
||||
-- 输出结果示例
|
||||
SELECT
|
||||
id,
|
||||
exam_name,
|
||||
score,
|
||||
round1_score,
|
||||
round2_score,
|
||||
round3_score
|
||||
FROM exams
|
||||
LIMIT 5;
|
||||
|
||||
Reference in New Issue
Block a user