Files
stripstream-librarian/infra/migrations/0060_add_download_detection_job.sql
Froidefond Julien d2c9f28227 feat: add download detection job with Prowlarr integration
For each series with missing volumes and an approved metadata link,
calls Prowlarr to find available matching releases and stores them in
a report (no auto-download). Includes per-series detail page, Telegram
notifications with per-event toggles, and stats display in the jobs table.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-25 13:47:29 +01:00

21 lines
973 B
SQL

ALTER TABLE index_jobs
DROP CONSTRAINT IF EXISTS index_jobs_type_check,
ADD CONSTRAINT index_jobs_type_check
CHECK (type IN ('scan', 'rebuild', 'full_rebuild', 'rescan', 'thumbnail_rebuild', 'thumbnail_regenerate', 'cbr_to_cbz', 'metadata_batch', 'metadata_refresh', 'reading_status_match', 'reading_status_push', 'download_detection'));
CREATE TABLE download_detection_results (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
job_id UUID NOT NULL REFERENCES index_jobs(id) ON DELETE CASCADE,
library_id UUID NOT NULL,
series_name TEXT NOT NULL,
-- 'found' | 'not_found' | 'no_missing' | 'no_metadata' | 'error'
status TEXT NOT NULL,
missing_count INTEGER NOT NULL DEFAULT 0,
-- JSON array of available Prowlarr releases (simplified)
available_releases JSONB,
error_message TEXT,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
CREATE INDEX download_detection_results_job_id_idx ON download_detection_results(job_id);