generated from coulomb/repo-seed
Extract the first reusable slice (models, schemas, routers, MCP, migrations) from state-hub with INTENT/SCOPE, agent instructions, workplan, and aligned inter_hub capability registry index.
24 lines
863 B
Python
24 lines
863 B
Python
import uuid
|
|
|
|
from sqlalchemy import String, Text
|
|
from sqlalchemy.dialects.postgresql import UUID
|
|
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
|
|
|
from hub_core.models.base import Base, TimestampMixin, new_uuid
|
|
|
|
|
|
class Domain(Base, TimestampMixin):
|
|
__tablename__ = "domains"
|
|
|
|
id: Mapped[uuid.UUID] = mapped_column(
|
|
UUID(as_uuid=True), primary_key=True, default=new_uuid
|
|
)
|
|
slug: Mapped[str] = mapped_column(String(50), unique=True, nullable=False, index=True)
|
|
name: Mapped[str] = mapped_column(String(200), nullable=False)
|
|
description: Mapped[str | None] = mapped_column(Text, nullable=True)
|
|
status: Mapped[str] = mapped_column(String(20), nullable=False, default="active")
|
|
|
|
repos: Mapped[list["ManagedRepo"]] = relationship( # noqa: F821
|
|
"ManagedRepo", back_populates="domain", lazy="selectin"
|
|
)
|