0.2.76 - Icon Packs
This commit is contained in:
@@ -792,3 +792,42 @@ CREATE INDEX IF NOT EXISTS credits_scan_history_item_time_idx
|
||||
ON credits_scan_history (item_id, finished_at DESC);
|
||||
CREATE INDEX IF NOT EXISTS credits_scan_history_time_idx
|
||||
ON credits_scan_history (finished_at DESC);
|
||||
|
||||
-- Work Sonarr and Radarr told the gateway about.
|
||||
--
|
||||
-- This is the one queue in the schema that is durable, and the reason is that a webhook is
|
||||
-- gone once it has been dropped: a Tracearr-derived credits candidate is rebuilt from one
|
||||
-- query on restart, while "Sonarr imported this at 19:05" cannot be rederived from
|
||||
-- anything. A container restarted during the settle delay must still re-read the file.
|
||||
--
|
||||
-- The key is derived from the *file* rather than from the delivery, so ON CONFLICT is what
|
||||
-- makes repeated webhook delivery safe: two notifications about one import collapse onto
|
||||
-- one row, while a file deleted and re-imported is a different file and its own work.
|
||||
--
|
||||
-- Completed rows are kept rather than deleted. They are the operator's record of why an
|
||||
-- item was re-read, which is the question the Imports page exists to answer; housekeeping
|
||||
-- prunes them.
|
||||
CREATE TABLE IF NOT EXISTS library_ingest_queue (
|
||||
key TEXT PRIMARY KEY,
|
||||
action TEXT NOT NULL,
|
||||
kind TEXT NOT NULL,
|
||||
reason TEXT NOT NULL DEFAULT '',
|
||||
source TEXT NOT NULL DEFAULT '',
|
||||
payload JSONB NOT NULL DEFAULT '{}'::jsonb,
|
||||
state TEXT NOT NULL DEFAULT 'pending',
|
||||
outcome TEXT NOT NULL DEFAULT '',
|
||||
item_id TEXT NOT NULL DEFAULT '',
|
||||
attempts INT NOT NULL DEFAULT 0,
|
||||
last_error TEXT NOT NULL DEFAULT '',
|
||||
due_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT now()
|
||||
);
|
||||
|
||||
-- The worker's only query: what is due. Partial, because settled rows outnumber pending
|
||||
-- ones by orders of magnitude within a day of the feature being switched on.
|
||||
CREATE INDEX IF NOT EXISTS library_ingest_pending_idx
|
||||
ON library_ingest_queue (due_at)
|
||||
WHERE state = 'pending';
|
||||
CREATE INDEX IF NOT EXISTS library_ingest_recent_idx
|
||||
ON library_ingest_queue (updated_at DESC);
|
||||
|
||||
Reference in New Issue
Block a user