Files
media-mirror-worker/src/main/resources/db/migration/V1__init.sql
T
Hermes Agent 72aa501a47
Build Media Mirror Worker / Build and publish (release) Successful in 1m36s
fix: V1__init.sql приведён к api-версии (uq_jobs_active_item), jackson-exclude из webmvc
2026-08-10 23:43:11 +03:00

20 lines
1.0 KiB
SQL

CREATE SCHEMA IF NOT EXISTS media_mirror;
CREATE TABLE media_mirror.jobs (
id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
item_id text NOT NULL, -- itemId из Jellyfin
source_url text NOT NULL, -- URL исходника (jellyfin stream)
source_type text NOT NULL DEFAULT 'jellyfin',
status text NOT NULL DEFAULT 'new', -- new | processing | done | failed | cancelled
progress int NOT NULL DEFAULT 0, -- 0..100
video_key text, -- S3-ключ видео (после done)
audio_keys jsonb, -- [{key, title, language, index}]
error text,
created_at timestamptz NOT NULL DEFAULT now(),
updated_at timestamptz NOT NULL DEFAULT now(),
taken_at timestamptz
);
CREATE INDEX IF NOT EXISTS idx_jobs_status ON media_mirror.jobs (status, created_at);
CREATE UNIQUE INDEX IF NOT EXISTS uq_jobs_active_item
ON media_mirror.jobs (item_id)
WHERE status NOT IN ('failed', 'cancelled');