diff options
| author | Christian Cleberg <[email protected]> | 2026-04-11 13:58:01 -0500 |
|---|---|---|
| committer | Christian Cleberg <[email protected]> | 2026-04-11 13:58:01 -0500 |
| commit | 6149ca9c394df7d316f80db05ad0fc2aea6c550d (patch) | |
| tree | 11f6cebc445e14b4a79adae648eb46d4be710071 /src/srht_contrib/models.py | |
| parent | b6d1348abf907b8b9c16ab87487eb9384dc4cc89 (diff) | |
| download | hutch-stats-6149ca9c394df7d316f80db05ad0fc2aea6c550d.tar.gz hutch-stats-6149ca9c394df7d316f80db05ad0fc2aea6c550d.tar.bz2 hutch-stats-6149ca9c394df7d316f80db05ad0fc2aea6c550d.zip | |
feat: add lazy actor indexing for contribution lookups
Diffstat (limited to 'src/srht_contrib/models.py')
| -rw-r--r-- | src/srht_contrib/models.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/srht_contrib/models.py b/src/srht_contrib/models.py index b87f464..2f33482 100644 --- a/src/srht_contrib/models.py +++ b/src/srht_contrib/models.py @@ -2,7 +2,7 @@ from __future__ import annotations from datetime import datetime -from sqlalchemy import JSON, DateTime, Float, Index, Integer, String, Text, UniqueConstraint +from sqlalchemy import JSON, Boolean, DateTime, Float, Index, Integer, String, Text, UniqueConstraint from sqlalchemy.orm import Mapped, mapped_column from srht_contrib.db import Base @@ -58,3 +58,16 @@ class ActorAlias(Base): id: Mapped[int] = mapped_column(Integer, primary_key=True) canonical_actor: Mapped[str] = mapped_column(String(255), nullable=False) alias: Mapped[str] = mapped_column(String(255), nullable=False) + + +class TrackedActor(Base): + __tablename__ = "tracked_actors" + __table_args__ = (UniqueConstraint("actor", name="uq_tracked_actor_actor"),) + + id: Mapped[int] = mapped_column(Integer, primary_key=True) + actor: Mapped[str] = mapped_column(String(255), nullable=False) + is_active: Mapped[bool] = mapped_column(Boolean, nullable=False, default=True) + last_requested_at: Mapped[datetime | None] = mapped_column(DateTime(timezone=True), nullable=True) + last_polled_at: Mapped[datetime | None] = mapped_column(DateTime(timezone=True), nullable=True) + last_poll_status: Mapped[str | None] = mapped_column(String(32), nullable=True) + last_poll_error: Mapped[str | None] = mapped_column(Text, nullable=True) |
