| 12345678910111213141516171819202122232425 |
- """
- 系统配置历史记录模型(与 system_config 镜像 + his 字段)
- """
- from sqlalchemy import Column, Integer, String, DateTime, SmallInteger, Enum
- from app.database import Base
- from app.utils.timezone import beijing_now
- class SystemConfigHis(Base):
- """系统配置表历史记录(与 system_config 镜像)"""
- __tablename__ = "system_config_his"
- id = Column(Integer, primary_key=True, comment="原表主键ID")
- config_key = Column(String(100), nullable=False, index=True, comment="配置键名")
- config_value = Column(String(500), nullable=False, comment="配置值")
- config_type = Column(Enum('int', 'string', 'bool', 'json'), default='string', comment="配置值类型")
- app_name = Column(String(100), default='backend-admin', comment="所属应用")
- description = Column(String(255), comment="配置描述")
- is_system = Column(SmallInteger, default=1, comment="是否为系统配置:1-是,0-否")
- is_editable = Column(SmallInteger, default=1, comment="是否可编辑:1-是,0-否")
- is_deleted = Column(SmallInteger, default=0, comment="是否删除:0-否,1-是")
- created_at = Column(DateTime, comment="创建时间")
- updated_at = Column(DateTime, comment="更新时间")
- his_created_at = Column(DateTime, primary_key=True, default=beijing_now, comment="历史记录创建时间")
- his_operation = Column(String(10), nullable=False, comment="操作类型:INSERT/UPDATE/DELETE")
|