23 lines
763 B
Python
23 lines
763 B
Python
import uuid
|
|
from typing import Any
|
|
|
|
from sqlalchemy import JSON, ForeignKey, String, UniqueConstraint
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
|
|
from app.models.base import Base, TimestampMixin, UUIDMixin
|
|
|
|
|
|
class Config(Base, UUIDMixin, TimestampMixin):
|
|
__tablename__ = "config"
|
|
__table_args__ = (
|
|
UniqueConstraint("scope_type", "scope_id", "tool_definition_id", "key"),
|
|
)
|
|
|
|
scope_type: Mapped[str] = mapped_column(String(50))
|
|
scope_id: Mapped[uuid.UUID] = mapped_column(index=True)
|
|
tool_definition_id: Mapped[uuid.UUID | None] = mapped_column(
|
|
ForeignKey("tool_definition.id"), nullable=True, index=True
|
|
)
|
|
key: Mapped[str] = mapped_column(String(255))
|
|
value: Mapped[dict[str, Any]] = mapped_column(JSON)
|