"""AI PMO 项目群快照模型。""" from __future__ import annotations from typing import Any, Optional from sqlalchemy import Integer, VARCHAR from sqlalchemy.orm import Mapped, mapped_column from .base import Base from .types import JSONB class PortfolioSnapshot(Base): __tablename__ = "portfolio_snapshots" id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True) scope_type: Mapped[str] = mapped_column(VARCHAR(20), nullable=False, default="tenant", index=True) scope_ref: Mapped[str] = mapped_column(VARCHAR(64), nullable=False, index=True) summary: Mapped[Optional[Any]] = mapped_column(JSONB, nullable=True) payload: Mapped[Optional[Any]] = mapped_column(JSONB, nullable=True)