Spaces:
Sleeping
Sleeping
File size: 1,081 Bytes
551658a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | from sqlalchemy import Column, Integer, String, ForeignKey, Boolean, DateTime, text
from sqlalchemy.orm import relationship
from database import Base
class User(Base):
__tablename__ = "users"
id = Column(Integer, primary_key=True, index=True, comment='主键ID')
username = Column(String(50), unique=True, nullable=False, server_default="", index=True, comment='用户名')
password = Column(String(255), nullable=False, server_default="", comment='密码')
email = Column(String(100), unique=True, nullable=False, server_default="", index=True, comment='邮箱')
is_superadmin = Column(Boolean, nullable=False, server_default="0", comment='是否为超级管理员')
company_code = Column(String(50), nullable=False, server_default="", comment='公司编码')
created_at = Column(DateTime(timezone=True), nullable=False, server_default=text('CURRENT_TIMESTAMP'), comment='创建时间')
updated_at = Column(DateTime(timezone=True), nullable=False, server_default=text('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'), comment='更新时间')
|