class Student(db.Model): """学生""" __tablename__ = "student" id = db.Column(db.Integer, primary_key=True) # stu_id = db.Column(db.String(20), unique=True, nullable=False) stu_name = db.Column(db.String(32), nullable=False) stu_class = db.Column(db.String(20))
class GeographyScore(db.Model): """数学成绩表""" __tablename__ = "geographyscore" id = db.Column(db.Integer, primary_key=True) stu_id = db.Column(db.String(20), db.ForeignKey("student.stu_id"), nullable=False) exam_id = db.Column(db.Integer, db.ForeignKey("exam.id"), nullable=False) score = db.Column(db.Integer, default=0)
class BiologicalScore(db.Model): """生物成绩表""" __tablename__ = "biologicalscore" id = db.Column(db.Integer, primary_key=True) stu_id = db.Column(db.String(20), db.ForeignKey("student.stu_id"), nullable=False) exam_id = db.Column(db.Integer, db.ForeignKey("exam.id"), nullable=False) score = db.Column(db.Integer, default=0)
class Exam(db.Model): """考试""" __tablename__ = "exam" id = db.Column(db.Integer, primary_key=True) # name = db.Column(db.String(60), unique=True, nullable=False)