1.0.0初始化源代码
This commit is contained in:
32
backend/app/models/system_config.py
Normal file
32
backend/app/models/system_config.py
Normal file
@@ -0,0 +1,32 @@
|
||||
"""
|
||||
系统配置模型
|
||||
"""
|
||||
from sqlalchemy import Column, Integer, String, DateTime, Boolean, Text, JSON
|
||||
from sqlalchemy.sql import func
|
||||
|
||||
from .base import Base
|
||||
|
||||
|
||||
class SystemConfig(Base):
|
||||
"""系统配置表"""
|
||||
__tablename__ = "system_configs"
|
||||
|
||||
id = Column(Integer, primary_key=True, autoincrement=True, comment="配置 ID")
|
||||
|
||||
# 配置键值
|
||||
config_key = Column(String(100), unique=True, nullable=False, index=True, comment="配置键")
|
||||
config_value = Column(JSON, nullable=False, comment="配置值(JSON 格式)")
|
||||
config_type = Column(String(50), comment="配置类型(schedule/limit/probability等)")
|
||||
|
||||
# 描述信息
|
||||
description = Column(Text, comment="配置描述")
|
||||
|
||||
# 状态
|
||||
is_active = Column(Boolean, default=True, comment="是否启用")
|
||||
|
||||
# 时间戳
|
||||
created_at = Column(DateTime, server_default=func.now(), comment="创建时间")
|
||||
updated_at = Column(DateTime, server_default=func.now(), onupdate=func.now(), comment="更新时间")
|
||||
|
||||
def __repr__(self):
|
||||
return f"<SystemConfig(id={self.id}, key='{self.config_key}')>"
|
||||
Reference in New Issue
Block a user