| 123456789101112131415161718192021222324252627 |
- """
- 系统配置模型
- """
- from datetime import datetime
- from app.utils.timezone import beijing_now_naive
- from sqlalchemy import Column, Integer, String, DateTime, Boolean, Text
- from app.database import Base
- class SystemConfig(Base):
- """系统配置表 - 纵表设计"""
- __tablename__ = "system_config"
-
- id = Column(Integer, primary_key=True, autoincrement=True, comment="主键ID")
- config_key = Column(String(100), nullable=False, comment="配置键名")
- config_value = Column(Text, nullable=True, comment="配置值")
- config_type = Column(String(20), default="string", comment="类型: int/string/bool/json")
- app_name = Column(String(50), nullable=True, comment="所属应用(backend-admin/backend-client)")
- description = Column(String(255), nullable=True, comment="配置描述")
- is_system = Column(Boolean, default=False, comment="是否系统配置")
- is_editable = Column(Boolean, default=True, comment="是否可编辑")
- is_deleted = Column(Boolean, default=False, comment="是否删除: 0-否, 1-是")
- created_at = Column(DateTime, default=beijing_now_naive, comment="创建时间")
- updated_at = Column(DateTime, default=beijing_now_naive, onupdate=beijing_now_naive, comment="更新时间")
-
- def __repr__(self):
- return f"<SystemConfig(id={self.id}, config_key='{self.config_key}')>"
|