67c002b665
Source-controlled baseline before Phase 5 cron. Excludes oracle.db, logs/, and __pycache__ via .gitignore. Pipeline verified running clean end-to-end (run_log write confirmed before conn.close()).
34 lines
1.3 KiB
SQL
34 lines
1.3 KiB
SQL
CREATE TABLE IF NOT EXISTS entries (
|
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
source TEXT NOT NULL,
|
|
source_id TEXT NOT NULL,
|
|
url TEXT,
|
|
title TEXT,
|
|
extracted_text TEXT,
|
|
summary TEXT,
|
|
category_tags TEXT,
|
|
signal_score REAL,
|
|
raw_metadata TEXT,
|
|
first_seen TEXT DEFAULT (strftime('%Y-%m-%dT%H:%M:%SZ', 'now')),
|
|
last_updated TEXT DEFAULT (strftime('%Y-%m-%dT%H:%M:%SZ', 'now')),
|
|
UNIQUE(source, source_id)
|
|
);
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_entries_source ON entries(source);
|
|
CREATE INDEX IF NOT EXISTS idx_entries_signal ON entries(signal_score DESC);
|
|
CREATE INDEX IF NOT EXISTS idx_entries_category ON entries(category_tags);
|
|
|
|
-- Run log: records each pipeline invocation for failure visibility + growth control.
|
|
-- Partial failures (e.g. Reddit rate-limited) are detectable here, not hidden
|
|
-- as a "complete" run. Also enables future pruning decisions (entries older
|
|
-- than N days with no re-fetch can be archived).
|
|
CREATE TABLE IF NOT EXISTS run_log (
|
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
run_time TEXT DEFAULT (strftime('%Y-%m-%dT%H:%M:%SZ', 'now')),
|
|
total_fetched INTEGER DEFAULT 0,
|
|
total_stored INTEGER DEFAULT 0,
|
|
sources_ok TEXT, -- JSON list of sources that succeeded
|
|
sources_failed TEXT, -- JSON list of sources that errored/skipped
|
|
notes TEXT
|
|
);
|