26 lines
1.1 KiB
Python
26 lines
1.1 KiB
Python
"""项目模型 - 含 PMFlow 与 Neural Sync 字段"""
|
|
from .base import Base
|
|
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
|
from sqlalchemy import BigInteger, Integer, VARCHAR, Text, ForeignKey
|
|
from typing import Optional
|
|
|
|
|
|
class Project(Base):
|
|
__tablename__ = "projects"
|
|
|
|
id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True)
|
|
name: Mapped[str] = mapped_column(VARCHAR(255), nullable=False)
|
|
title: Mapped[Optional[str]] = mapped_column(VARCHAR(255), nullable=True)
|
|
description: Mapped[Optional[str]] = mapped_column(Text, nullable=True)
|
|
owner_id: Mapped[Optional[int]] = mapped_column(
|
|
BigInteger, ForeignKey("users.id"), nullable=True
|
|
)
|
|
status: Mapped[str] = mapped_column(VARCHAR(50), nullable=False)
|
|
domain_id: Mapped[Optional[int]] = mapped_column(BigInteger, nullable=True)
|
|
assigned_role: Mapped[Optional[str]] = mapped_column(VARCHAR(50), nullable=True)
|
|
signal_count: Mapped[int] = mapped_column(BigInteger, nullable=False, default=0)
|
|
|
|
signal_links = relationship(
|
|
"ProjectSignalLink", back_populates="project", cascade="all, delete-orphan"
|
|
)
|