knowledge_base.py 693 B

123456789101112131415
  1. from core_db import AuditMixin, Base, EntityMixin, VersionMixin
  2. from core_shared import JSONValue
  3. from sqlalchemy import String, Text
  4. from sqlalchemy.dialects.sqlite import JSON
  5. from sqlalchemy.orm import Mapped, mapped_column
  6. class KnowledgeBase(EntityMixin, 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)