Files
2026-02-27 23:33:56 +03:00

27 lines
891 B
Python

from __future__ import annotations
import uuid
from sqlalchemy import ForeignKey, JSON, String, Text
from sqlalchemy.dialects.postgresql import UUID
from sqlalchemy.orm import Mapped, mapped_column
from cpv3.db.base import Base, BaseModelMixin
class Project(Base, BaseModelMixin):
__tablename__ = "projects"
owner_id: Mapped[uuid.UUID] = mapped_column(
UUID(as_uuid=True),
ForeignKey("users.id", ondelete="RESTRICT"),
index=True,
)
name: Mapped[str] = mapped_column(String(255))
description: Mapped[str | None] = mapped_column(Text, nullable=True)
language: Mapped[str] = mapped_column(String(4), default="auto")
folder: Mapped[str | None] = mapped_column(String(1024), nullable=True)
status: Mapped[str] = mapped_column(String(16), default="DRAFT")
workspace_state: Mapped[dict | None] = mapped_column(JSON, nullable=True)