srrdb: persist per-day harvest ledger alongside releases
Add srrdb_log table with composite primary key (day, category) and counters found, stored, ignored plus run_at. Replace the release-only persistence path with UpsertAllSrrdbWithDay so releases and their corresponding srrdb_log row are written in one SQLite transaction. Preserve existing error handling: rollback reports the release/day that failed, and commit errors return without writing a dump. Handle fully ignored days as closed. When every fetched release is skipped by ignore rules, still write the ledger row with zero stored releases. This prevents the automatic day walk from endlessly retrying a day whose releases are filtered out. Derive and validate the ledger day from the resolved request URI. Missing or invalid date: segments now fail before database writes. Keep run_at independent from created_at semantics and continue populating created_at from the run time. Preserve column and upsert semantics. category continues to use NOT NULL DEFAULT empty string; status keeps COALESCE behavior on conflict; nfo, content, and synced_at remain unchanged.
This commit is contained in:
+12
-1
@@ -36,4 +36,15 @@ CREATE INDEX IF NOT EXISTS idx_srrdb_group
|
||||
ON srrdb_releases (group_name);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_srrdb_status
|
||||
ON srrdb_releases (status);
|
||||
ON srrdb_releases (status);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS srrdb_log
|
||||
(
|
||||
day TEXT NOT NULL,
|
||||
category TEXT NOT NULL,
|
||||
found INTEGER NOT NULL,
|
||||
stored INTEGER NOT NULL,
|
||||
ignored INTEGER NOT NULL,
|
||||
run_at TEXT NOT NULL,
|
||||
PRIMARY KEY (day, category)
|
||||
);
|
||||
Reference in New Issue
Block a user