-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschema.sql
More file actions
38 lines (35 loc) · 1.29 KB
/
Copy pathschema.sql
File metadata and controls
38 lines (35 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
-- PostgreSQL-ready persistence model for the ingestion milestone.
create table if not exists sources (
id text primary key,
name text not null,
homepage_url text not null,
feed_url text,
source_type text not null check (source_type in ('rss', 'youtube')),
enabled boolean not null default true,
last_success_at timestamptz,
last_error text
);
create table if not exists feed_items (
id text primary key,
canonical_url text not null unique,
source_id text not null references sources(id),
title text not null,
excerpt text not null,
author text,
published_at timestamptz not null,
kind text not null check (kind in ('article', 'video', 'research')),
topics text[] not null default '{}',
relevance smallint not null check (relevance between 0 and 100),
raw_payload jsonb,
created_at timestamptz not null default now(),
updated_at timestamptz not null default now()
);
create index if not exists feed_items_published_at_idx on feed_items (published_at desc);
create index if not exists feed_items_topics_idx on feed_items using gin (topics);
create table if not exists enrichments (
feed_item_id text primary key references feed_items(id) on delete cascade,
model text not null,
summary text not null,
why_it_matters text,
created_at timestamptz not null default now()
);