17 lines
656 B
Python
17 lines
656 B
Python
from sqlalchemy import Column, Integer, String, DateTime
|
|
from sqlalchemy.sql import func
|
|
from app.database.database import Base
|
|
|
|
|
|
class User(Base):
|
|
"""用户模型"""
|
|
__tablename__ = "users"
|
|
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
username = Column(String(50), unique=True, index=True, nullable=False)
|
|
password = Column(String(100), nullable=False)
|
|
department = Column(String(50), nullable=False)
|
|
role = Column(String(20), nullable=False) # admin, marketing, other
|
|
created_at = Column(DateTime(timezone=True), server_default=func.now())
|
|
updated_at = Column(DateTime(timezone=True), onupdate=func.now())
|