[object Object]

← back to Nineoh Guide

fix(db): news_items schema drift — add source_query + unique(canonical_url), drop NOT NULL on summary_original (index-first, summarize-on-review)

50992ce5de47d28f66a5718d80decf4c9eb20b22 · 2026-07-27 08:46:48 -0700 · Steve Abrams

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Files touched

Diff

commit 50992ce5de47d28f66a5718d80decf4c9eb20b22
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Mon Jul 27 08:46:48 2026 -0700

    fix(db): news_items schema drift — add source_query + unique(canonical_url), drop NOT NULL on summary_original (index-first, summarize-on-review)
    
    Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---
 db/schema.sql | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/db/schema.sql b/db/schema.sql
index 14916e3..19f0cd0 100644
--- a/db/schema.sql
+++ b/db/schema.sql
@@ -94,7 +94,7 @@ create index if not exists idx_egc_ep on episode_guest_cast(episode_id);
 create table if not exists news_items (
   id                uuid primary key default uuid_generate_v4(),
   headline          text not null,
-  summary_original  text not null,          -- one-sentence ORIGINAL summary
+  summary_original  text,                   -- one-sentence ORIGINAL summary (written at review; null while snippet_status='indexed')
   canonical_url     text not null,
   publisher_name    text,
   published_at      timestamptz,
@@ -102,8 +102,10 @@ create table if not exists news_items (
   person_ids        uuid[] default '{}',
   show_ids          uuid[] default '{}',
   snippet_status    text default 'pending',
+  source_query      text,                   -- the Google-News query that surfaced this item
   editor_reviewed_at timestamptz,
-  created_at        timestamptz not null default now()
+  created_at        timestamptz not null default now(),
+  unique (canonical_url)                     -- ingest-news.mjs upserts on conflict (canonical_url)
 );
 
 -- ── Assets = the RIGHTS LEDGER (the legally critical table) ─────────────────

← b3f641d chore: version-up to v0.2.0 (session close) — code tsc/CTA/5  ·  back to Nineoh Guide  ·  auto-save: 2026-07-27T08:49:12 (4 files) — apps/web/.agents/ 00e7162 →