@@ -48,7 +48,6 @@ class School(BaseDBClass):
4848 teacher : Mapped ["ZhiXueTeacherAccount" ] = relationship ("ZhiXueTeacherAccount" , back_populates = "school" )
4949 student_accounts : Mapped [list ["ZhiXueStudentAccount" ]] = relationship (
5050 "ZhiXueStudentAccount" , back_populates = "school" )
51- exams : Mapped [list ["Exam" ]] = relationship ("Exam" , back_populates = "school" )
5251
5352
5453class ZhiXueTeacherAccount (BaseDBClass ):
@@ -141,18 +140,10 @@ class Exam(BaseDBClass):
141140 id : Mapped [str ] = mapped_column (String (50 ), primary_key = True , unique = True )
142141 name : Mapped [str ] = mapped_column (String (255 ))
143142 created_at : Mapped [float ] = mapped_column (Float )
144- # DEPRECATED: is_saved 已迁移到 ExamSchool.is_saved(支持联考后每个学校独立保存状态)
145- # 保留此字段用于向下兼容,数据库迁移时会删除
146- is_saved : Mapped [bool ] = mapped_column (Boolean , default = False )
147- # DEPRECATED: school_id 已改为多对多关系(通过 ExamSchool 表)
148- # 保留此字段用于向下兼容,新代码应使用 schools 关系
149- school_id : Mapped [Optional [str ]] = mapped_column (String (50 ), ForeignKey ("schools.id" ), nullable = True )
150143
151144 user_exams : Mapped [list ["UserExam" ]] = relationship ("UserExam" , back_populates = "exam" )
152145 scores : Mapped [list ["Score" ]] = relationship ("Score" , back_populates = "exam" )
153- # DEPRECATED: 保留单一 school 关系用于向下兼容
154- school : Mapped [Optional ["School" ]] = relationship ("School" , foreign_keys = [school_id ], back_populates = "exams" )
155- # 新的多对多关系
146+ # 多对多关系
156147 schools : Mapped [list ["ExamSchool" ]] = relationship ("ExamSchool" , back_populates = "exam" )
157148
158149 __table_args__ = (
0 commit comments