feat: 重构学员目标系统,支持评估日期/状态自动计算/评估目标,同时恢复方案列表的典型设置
This commit is contained in:
@@ -154,6 +154,25 @@ def create_app():
|
||||
{"new_cat": new_cat, "old_cat": old_cat}
|
||||
)
|
||||
db.session.commit()
|
||||
|
||||
# 检查student_goals表是否有新字段
|
||||
result8 = db.session.execute(text("PRAGMA table_info(student_goals)"))
|
||||
sg_columns = [row[1] for row in result8]
|
||||
if "start_date" not in sg_columns:
|
||||
db.session.execute(text("ALTER TABLE student_goals ADD COLUMN start_date TIMESTAMP"))
|
||||
db.session.commit()
|
||||
if "assessment_date" not in sg_columns:
|
||||
db.session.execute(text("ALTER TABLE student_goals ADD COLUMN assessment_date TIMESTAMP"))
|
||||
db.session.commit()
|
||||
if "achievement_date" not in sg_columns:
|
||||
db.session.execute(text("ALTER TABLE student_goals ADD COLUMN achievement_date TIMESTAMP"))
|
||||
db.session.commit()
|
||||
if "comment" not in sg_columns:
|
||||
db.session.execute(text("ALTER TABLE student_goals ADD COLUMN comment TEXT"))
|
||||
db.session.commit()
|
||||
# 删除不再使用的字段
|
||||
# deadline 和 completed_at 已被 start_date, assessment_date, achievement_date 取代
|
||||
# status 字段现在由日期计算,不再存储
|
||||
except Exception as e:
|
||||
print(f"数据库迁移: {e}")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user