24 lines
632 B
Python
24 lines
632 B
Python
#创建顾问表
|
|
from sqlalchemy import Column, Integer, String, Boolean, Date
|
|
from sqlalchemy.orm import relationship
|
|
|
|
from database import Base
|
|
|
|
|
|
|
|
class Counselor(Base):
|
|
__tablename__ = 'counselor'
|
|
id = Column(Integer, primary_key=True,autoincrement=True)
|
|
name = Column(String(100),nullable=False,unique=True)
|
|
c_time = Column(Date,nullable=False) #创建时间
|
|
c_de = Column(Boolean,default=False) #逻辑判断
|
|
|
|
#关联班级表,一对多
|
|
classes=relationship("Classes",back_populates="counselor")
|
|
|
|
def __repr__(self):
|
|
return f"<Counselor(id={self.id}, name={self.name})>"
|
|
|
|
|
|
|