This commit is contained in:
ponzischeme89
2026-08-12 08:25:15 +12:00
parent e30962245e
commit 4b31946635
28 changed files with 439 additions and 130 deletions
+12 -2
View File
@@ -155,8 +155,8 @@ CREATE TABLE IF NOT EXISTS row_events (
CREATE INDEX IF NOT EXISTS row_events_time_idx ON row_events (occurred_at DESC);
CREATE INDEX IF NOT EXISTS row_events_row_idx ON row_events (row_id, occurred_at DESC);
-- Significant, user-scoped app journeys. Values are deliberately categorical: content
-- names, search terms, setting values and other free text do not belong in this table.
-- Significant, user-scoped app journeys. Item names make content events recognisable;
-- search terms, setting values and other arbitrary free text do not belong in this table.
-- journey_id is generated by the client for one foreground visit; emby_user_id is always
-- taken from the authenticated gateway session rather than trusted from the payload.
CREATE TABLE IF NOT EXISTS journey_events (
@@ -172,10 +172,13 @@ CREATE TABLE IF NOT EXISTS journey_events (
source TEXT NOT NULL DEFAULT '',
target TEXT NOT NULL DEFAULT '',
item_id TEXT NOT NULL DEFAULT '',
item_name TEXT NOT NULL DEFAULT '',
item_type TEXT NOT NULL DEFAULT '',
outcome TEXT NOT NULL DEFAULT ''
);
ALTER TABLE journey_events ADD COLUMN IF NOT EXISTS item_name TEXT NOT NULL DEFAULT '';
CREATE UNIQUE INDEX IF NOT EXISTS journey_events_journey_sequence_idx
ON journey_events (emby_user_id, journey_id, sequence);
CREATE INDEX IF NOT EXISTS journey_events_user_time_idx
@@ -256,6 +259,13 @@ CREATE TABLE IF NOT EXISTS sonarr_series_status_history (
CREATE INDEX IF NOT EXISTS sonarr_series_status_history_series_time_idx
ON sonarr_series_status_history (series_key, observed_at DESC, id DESC);
-- Separates the scanner's first baseline from a genuinely new series discovered later.
-- A dedicated marker also handles an initially empty Sonarr library correctly.
CREATE TABLE IF NOT EXISTS sonarr_lifecycle_scan_state (
singleton BOOLEAN PRIMARY KEY DEFAULT true CHECK (singleton),
seeded_at TIMESTAMPTZ NOT NULL DEFAULT now()
);
-- Recommendation-relevant Tracearr history. The public Tracearr API has no user or
-- since cursor, so stable source ids make these rows the durable deduplication boundary.
-- Deliberately omit artwork, stream-detail blobs and other fields unused by ranking.