Files
xpack-mcp/services/common/models/sys_config.py
T

40 lines
1.4 KiB
Python

from sqlalchemy import BigInteger, String, DateTime
from sqlalchemy.sql import func
from sqlalchemy.orm import Mapped, mapped_column
from services.common.models.base import Base
from datetime import datetime
class SysConfig(Base):
__tablename__ = "sys_config"
__table_args__ = (
{"mysql_engine": "InnoDB", "mysql_charset": "utf8mb4"},
{"mysql_comment": "System configuration table"},
{"mysql_indexes": [{"name": "idx_key_tenant_id", "columns": ["key", "tenant_id"]}]},
)
id: Mapped[str] = mapped_column(
String(36),
primary_key=True,
autoincrement=False,
comment="Primary key",
)
key: Mapped[str] = mapped_column(String(255), unique=True, nullable=False, comment="Configuration key")
tenant_id: Mapped[str] = mapped_column(String(36), nullable=False, comment="Tenant ID")
value: Mapped[str] = mapped_column(String, nullable=False, comment="Configuration value")
description: Mapped[str] = mapped_column(String, nullable=False, comment="Configuration description")
created_at: Mapped[datetime] = mapped_column(
DateTime,
nullable=True,
server_default=func.current_timestamp(),
comment="Creation timestamp",
)
updated_at: Mapped[datetime] = mapped_column(
DateTime,
nullable=True,
server_default=func.current_timestamp(),
server_onupdate=func.current_timestamp(),
comment="Last update timestamp",
)