diff --git a/build.gradle.kts b/build.gradle.kts index 14fc759..0c7bbdd 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -24,13 +24,6 @@ kotlin { configurations { named("runtimeClasspath") { - exclude(group = "tools.jackson.core") - exclude(group = "tools.jackson.databind") - exclude(group = "com.fasterxml.jackson.core") - exclude(group = "com.fasterxml.jackson.databind") - exclude(group = "com.fasterxml.jackson.datatype") - exclude(group = "com.fasterxml.jackson.dataformat") - exclude(group = "com.fasterxml.jackson.module") } } @@ -45,7 +38,9 @@ configurations.all { dependencies { implementation(platform("org.springframework.boot:spring-boot-dependencies:4.1.0")) - implementation("org.springframework.boot:spring-boot-starter-webmvc") + implementation("org.springframework.boot:spring-boot-starter-webmvc") { + exclude(group = "org.springframework.boot", module = "spring-boot-starter-jackson") + } implementation("org.springframework.boot:spring-boot-starter-jdbc") implementation("org.springframework.boot:spring-boot-starter-flyway") implementation("org.flywaydb:flyway-database-postgresql") diff --git a/src/main/resources/db/migration/V1__init.sql b/src/main/resources/db/migration/V1__init.sql index 22d0faf..4159c1e 100644 --- a/src/main/resources/db/migration/V1__init.sql +++ b/src/main/resources/db/migration/V1__init.sql @@ -1,18 +1,19 @@ CREATE SCHEMA IF NOT EXISTS media_mirror; - -CREATE TABLE IF NOT EXISTS media_mirror.jobs ( +CREATE TABLE media_mirror.jobs ( id uuid PRIMARY KEY DEFAULT gen_random_uuid(), - item_id text NOT NULL, - source_url text NOT NULL, + 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', - progress int NOT NULL DEFAULT 0, - video_key text, - audio_keys jsonb, + 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');