""" API密钥历史记录模型 """ from sqlalchemy import Column, Integer, Text, DateTime, SmallInteger, String from app.database import Base class APIKeyHis(Base): """API密钥表历史记录""" __tablename__ = "api_keys_his" his_id = Column(Integer, primary_key=True, autoincrement=True, comment="历史记录主键ID") id = Column(Integer, nullable=False, comment="原表主键ID") public_key = Column(Text, nullable=False, comment="RSA公钥") private_key = Column(Text, nullable=False, comment="RSA私钥") key_version = Column(Integer, nullable=False, comment="密钥版本号") is_active = Column(SmallInteger, default=1, comment="是否激活") is_deleted = Column(SmallInteger, default=0, comment="是否删除:0-否,1-是") created_at = Column(DateTime, comment="创建时间") expire_at = Column(DateTime, comment="过期时间") his_created_at = Column(DateTime, comment="历史记录创建时间") his_operation = Column(String(10), nullable=False, comment="操作类型:INSERT/UPDATE/DELETE")