新增cls_mgmt_model
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
from sqlalchemy import Column, Integer, String, DateTime, Date
|
||||
from sqlalchemy.sql import func
|
||||
from database import Base
|
||||
|
||||
class ClsMgmt(Base):
|
||||
"""
|
||||
班级管理表模型
|
||||
对应 MySQL 中的 cls_mgmt 表
|
||||
"""
|
||||
__tablename__ = "cls_mgmt" # 表名
|
||||
|
||||
# 字段定义
|
||||
id = Column(String(15), primary_key=True, nullable=False) # 班级编号,主键,非空
|
||||
cls_start_date= Column(Date, nullable=False) #开课时间
|
||||
head_tea_id =Column(String(15),nullable=False) # 班主任id
|
||||
lecturer_id=Column(String(15),nullable=False) # 主讲老师id
|
||||
is_deleted=Column(Integer,nullable=False)
|
||||
# created_at:创建时间,自动设置为当前时间(服务器时间)
|
||||
# server_default=func.now() 表示由数据库生成默认值
|
||||
created_at = Column(DateTime(timezone=True), server_default=func.now())
|
||||
# updated_at:更新时间,当记录更新时自动设置为当前时间(由 SQLAlchemy 的 onupdate 触发)
|
||||
updated_at = Column(DateTime(timezone=True), onupdate=func.now())
|
||||
Reference in New Issue
Block a user