feat: add news_items table and summary model column

This commit is contained in:
Sirius DevOps 2026-08-27 22:40:50 -04:00
commit cbc573b830
2 changed files with 86 additions and 2 deletions

View file

@ -185,8 +185,8 @@ Index("ix_fires_bbox", fires.c.longitude, fires.c.latitude)
# ── News pipeline (scraper + summarizer) ──────────────────────────────────
# Written by the vendored news-scraper (Scrapy) / news-summarizer (Gemini)
# services; schema must match the idempotent alembic migration 003_news.
# Written by the vendored news-scraper (Scrapy) / news-summarizer services;
# schema must match the idempotent alembic migrations 003_news + 005_news_items.
articles = Table(
"articles",
@ -209,6 +209,26 @@ article_summaries = Table(
Column("summary_text", Text, nullable=False),
Column("batch_timestamp", DateTime(timezone=True),
server_default=func.now(), nullable=False),
Column("model", Text), # LLM id used for this batch; nullable for old rows
)
Index("ix_article_summaries_batch_timestamp", article_summaries.c.batch_timestamp)
news_items = Table(
"news_items",
metadata,
Column("id", Integer, primary_key=True, autoincrement=True),
Column("summary_id", Integer),
Column("kind", Text, nullable=False),
Column("headline", Text, nullable=False),
Column("importance", Text, nullable=False),
Column("location_name", Text),
Column("lat", Float),
Column("lon", Float),
Column("location_confidence", Text),
Column("category", Text),
Column("url", Text),
Column("created_at", DateTime(timezone=True), server_default=func.now(), nullable=False),
)
Index("ix_news_items_kind_created", news_items.c.kind, news_items.c.created_at)