Files
the-daily-epub/migrations/0006_rating_imports.sql
thalladaandClaude Fable 5.1 d94cefcbd7 Import historical ratings from arbitrary URLs as a background job
The Ratings page gains an "Import ratings" form: paste URLs (one per
line), choose a verdict and an optional note. Rows land in the new
rating_imports table and the new import-ratings job (same systemd job
template as the rest of the catalogue) canonicalizes each URL, reuses or
fetches + extracts the article, embeds it with Voyage when enabled, and
appends an explicit rating event with source "import". Per-URL status
shows on the Ratings page; the job page's journal is the live log.

Imported articles have no entry row (best_entry_id NULL, feed "Imported")
and no sources, so they act as rated neighbours without touching the
feed prior. The CLI's rating-event construction moves to rate::record_explicit
and the dashboard job start path is shared as jobs::start_job.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QVPagF6jfDv78CC5Jv2wp4
2026-09-06 17:31:41 +00:00

15 lines
585 B
SQL

CREATE TABLE rating_imports (
id INTEGER PRIMARY KEY AUTOINCREMENT,
url TEXT NOT NULL,
label TEXT NOT NULL CHECK (label IN ('loved', 'good', 'not_for_me')),
note TEXT,
status TEXT NOT NULL CHECK (status IN ('pending', 'ok', 'failed')),
message TEXT,
article_id INTEGER REFERENCES articles(id) ON DELETE SET NULL,
requested_by INTEGER REFERENCES users(id) ON DELETE SET NULL,
requested_at TEXT NOT NULL,
finished_at TEXT
);
CREATE INDEX idx_rating_imports_status_id ON rating_imports(status, id);