api_key_his.py 1.0 KB

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