forked from caojinliang/StuManagerSys
36 lines
1.4 KiB
Python
36 lines
1.4 KiB
Python
from database import DATETIME,Base,Column,Integer,String,ForeignKey,Boolean,Enum as SQLEnum,DateTime,DATETIME
|
|
from datetime import datetime
|
|
from database import engine
|
|
from enum import Enum
|
|
class Class(Base):
|
|
'''
|
|
班级信息数据库类模型
|
|
'''
|
|
__tablename__ = "s_class"
|
|
id = Column(Integer,
|
|
primary_key=True,
|
|
autoincrement=True,
|
|
index=True,#为该列创建索引,加快查询速度
|
|
comment='班级主键id')
|
|
class_id = Column(String(32),
|
|
nullable=False,
|
|
index=True,
|
|
comment='班级编号')
|
|
class_name = Column(String(32),
|
|
nullable=False,
|
|
index=True,
|
|
comment='班级名字')
|
|
ht_id = Column(Integer,
|
|
ForeignKey('s_teacher.id'),
|
|
nullable=False,
|
|
comment='班主任ID')
|
|
t_id = Column(Integer,
|
|
ForeignKey('s_teacher.id'),
|
|
nullable=False,
|
|
comment='授课老师ID')
|
|
start_time = Column(DATETIME,default=datetime.now,comment='开课时间')
|
|
update_time = Column(DATETIME,default=datetime.now,onupdate=datetime.now)
|
|
is_deleted = Column(Integer,default=0,index=True)
|
|
Base.metadata.create_all(engine)
|
|
|