knowledge_base.py 694 B

12345678910111213141516
  1. from sqlalchemy import String, Text
  2. from sqlalchemy.dialects.sqlite import JSON
  3. from sqlalchemy.orm import Mapped, mapped_column
  4. from core_db import AuditMixin, Base, TenantMixin, VersionMixin
  5. from core_shared import JSONValue
  6. class KnowledgeBase(TenantMixin, AuditMixin, VersionMixin, Base):
  7. __tablename__ = "knowledge_base"
  8. code: Mapped[str] = mapped_column(String(64), index=True)
  9. name: Mapped[str] = mapped_column(String(128))
  10. description: Mapped[str | None] = mapped_column(Text, nullable=True)
  11. status: Mapped[str] = mapped_column(String(32), default="active", index=True)
  12. metadata_json: Mapped[dict[str, JSONValue] | None] = mapped_column(JSON, nullable=True)