operation_log_his.py 1.1 KB

1234567891011121314151617181920212223
  1. """
  2. 操作日志历史记录模型
  3. """
  4. from sqlalchemy import Column, BigInteger, Integer, String, DateTime, Text, SmallInteger
  5. from app.database import Base
  6. class OperationLogHis(Base):
  7. """操作日志表历史记录"""
  8. __tablename__ = "operation_logs_his"
  9. his_id = Column(Integer, primary_key=True, autoincrement=True, comment="历史记录主键ID")
  10. id = Column(BigInteger, nullable=False, comment="原表主键ID")
  11. admin_id = Column(Integer, comment="管理员ID")
  12. module = Column(String(50), comment="操作模块")
  13. action = Column(String(50), comment="操作动作")
  14. description = Column(String(500), comment="操作描述")
  15. old_data = Column(Text, comment="操作前数据(JSON)")
  16. new_data = Column(Text, comment="操作后数据(JSON)")
  17. ip_address = Column(String(50), comment="IP地址")
  18. is_deleted = Column(SmallInteger, default=0, comment="是否删除:0-否,1-是")
  19. created_at = Column(DateTime, comment="操作时间")
  20. his_created_at = Column(DateTime, comment="历史记录创建时间")
  21. his_operation = Column(String(10), nullable=False, comment="操作类型:INSERT/UPDATE/DELETE")