diff --git a/CHANGELOG.md b/CHANGELOG.md index d95e7d6..740aa40 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,12 +6,16 @@ All schema changes will be documented in this file. - Hello, World! - Initial PCD 2.0 schema definition - - Core entity tables: quality_profiles, custom_formats, regular_expressions, - languages, tags, qualities, quality_groups - - Custom format conditions system with 11 condition types (patterns, language, - indexer_flag, source, resolution, quality_modifier, size, release_type, - year) - - Quality profile system supporting individual qualities and quality groups - - Junction tables for tags, quality groups, profile qualities, and profile - custom formats - - Unique index ensuring single upgrade_until per profile +- Core entity tables: quality_profiles, custom_formats, regular_expressions, + languages, tags, qualities, quality_groups +- Custom format conditions system with 11 condition types (patterns, language, + indexer_flag, source, resolution, quality_modifier, size, release_type, year) +- Quality profile system supporting individual qualities and quality groups +- Junction tables for tags, quality groups, profile qualities, and profile + custom formats +- Unique index ensuring single upgrade_until per profile +- Add arr_type support for Radarr/Sonarr differentiation + - custom_format_conditions.arr_type: conditions can be arr-specific or + universal + - quality_profile_custom_formats.arr_type: scores can differ between Radarr + and Sonarr diff --git a/base/0.initial.sql b/base/0.initial.sql index d82325d..0c99b33 100644 --- a/base/0.initial.sql +++ b/base/0.initial.sql @@ -83,9 +83,10 @@ CREATE TABLE custom_format_conditions ( id INTEGER PRIMARY KEY AUTOINCREMENT, custom_format_id INTEGER NOT NULL, name VARCHAR(100) NOT NULL, - type VARCHAR(50) NOT NULL, -- release_title, release_group, edition, language, etc. - negate INTEGER NOT NULL DEFAULT 0, -- Invert the match (e.g., "NOT language") - required INTEGER NOT NULL DEFAULT 0, -- Condition must match for format to apply + type VARCHAR(50) NOT NULL, + arr_type VARCHAR(20) NOT NULL, -- 'radarr', 'sonarr', 'all' + negate INTEGER NOT NULL DEFAULT 0, + required INTEGER NOT NULL DEFAULT 0, created_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP, updated_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP, FOREIGN KEY (custom_format_id) REFERENCES custom_formats(id) ON DELETE CASCADE @@ -152,8 +153,9 @@ CREATE TABLE quality_profile_qualities ( CREATE TABLE quality_profile_custom_formats ( quality_profile_id INTEGER NOT NULL, custom_format_id INTEGER NOT NULL, - score INTEGER NOT NULL, -- Positive scores prefer, negative scores reject - PRIMARY KEY (quality_profile_id, custom_format_id), + arr_type VARCHAR(20) NOT NULL, -- 'radarr', 'sonarr', 'all', + score INTEGER NOT NULL, + PRIMARY KEY (quality_profile_id, custom_format_id, arr_type), FOREIGN KEY (quality_profile_id) REFERENCES quality_profiles(id) ON DELETE CASCADE, FOREIGN KEY (custom_format_id) REFERENCES custom_formats(id) ON DELETE CASCADE );