Standing interests get a table of their own plus article_interests, the per-run top-3 matches, and a pure rates() that derives each interest's Beta-smoothed weight from current ratings the way feed affinity does. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01K9PrjtUS16PAQve8D4bHgc
19 lines
785 B
SQL
19 lines
785 B
SQL
CREATE TABLE interests (
|
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
name TEXT NOT NULL COLLATE NOCASE UNIQUE,
|
|
category TEXT, -- NULL until categorized
|
|
created_at TEXT NOT NULL,
|
|
categorized_at TEXT
|
|
);
|
|
CREATE INDEX idx_interests_category ON interests(category);
|
|
|
|
CREATE TABLE article_interests (
|
|
article_id INTEGER NOT NULL REFERENCES articles(id) ON DELETE CASCADE,
|
|
interest_id INTEGER NOT NULL REFERENCES interests(id) ON DELETE CASCADE,
|
|
cos REAL NOT NULL,
|
|
z REAL NOT NULL,
|
|
run_id INTEGER, -- NULL for backfilled rows
|
|
PRIMARY KEY (article_id, interest_id)
|
|
);
|
|
CREATE INDEX idx_article_interests_interest ON article_interests(interest_id, cos DESC);
|