""" 会话历史记录模型 """ from datetime import datetime from app.utils.timezone import beijing_now_naive from sqlalchemy import Column, Integer, String, DateTime, Boolean from app.database import Base from app.models.history_base import HistoryRecord class SessionHis(HistoryRecord): """会话历史记录表""" __tablename__ = "sessions_his" id = Column(Integer, primary_key=True, comment="原表主键ID") session_id = Column(String(64), nullable=False, comment="会话ID") user_id = Column(Integer, nullable=False, comment="用户ID") machine_code = Column(String(255), nullable=False, comment="机器码") is_active = Column(Boolean, default=True, comment="是否激活") expires_at = Column(DateTime, nullable=False, comment="过期时间") created_at = Column(DateTime, default=beijing_now_naive, comment="创建时间") updated_at = Column(DateTime, default=beijing_now_naive, comment="更新时间") def __repr__(self): return f""