@startuml Lidarr-Style Music Aggregator ERD skinparam linetype ortho skinparam ranksep 60 skinparam nodesep 40 skinparam entity { BackgroundColor White BorderColor #333333 } skinparam package { BackgroundColor #FAFAFA BorderColor #DDDDDD } title Music Aggregator - Lidarr-Style Database Structure ' ══════════════════════════════════════════════════════════════ ' CORE MUSIC ENTITIES ' ══════════════════════════════════════════════════════════════ package "Core Music Entities" #E3F2FD { entity "artist_metadata" { * id : UUID <> -- foreign_artist_id : TEXT <> name : TEXT sort_name : TEXT disambiguation : TEXT artist_type : TEXT status : TEXT overview : TEXT images : JSONB links : JSONB genres : JSONB ratings : JSONB members : JSONB -- created_at : TIMESTAMPTZ updated_at : TIMESTAMPTZ } entity "artists" { * id : UUID <> -- metadata_id : UUID <> quality_profile_id : UUID <> metadata_profile_id : UUID <> root_folder_id : UUID <> -- path : TEXT monitored : BOOLEAN monitor_new_items : TEXT -- last_info_sync : TIMESTAMPTZ added_at : TIMESTAMPTZ tags : INT[] } entity "albums" { * id : UUID <> -- artist_metadata_id : UUID <> -- foreign_album_id : TEXT <> title : TEXT clean_title : TEXT disambiguation : TEXT overview : TEXT album_type : TEXT secondary_types : JSONB release_date : DATE images : JSONB links : JSONB genres : JSONB ratings : JSONB -- monitored : BOOLEAN any_release_ok : BOOLEAN last_search_time : TIMESTAMPTZ added_at : TIMESTAMPTZ } entity "album_releases" { * id : UUID <> -- album_id : UUID <> -- foreign_release_id : TEXT <> title : TEXT disambiguation : TEXT status : TEXT duration_ms : INT release_date : DATE country : TEXT[] label : TEXT[] media : JSONB track_count : INT -- monitored : BOOLEAN } entity "tracks" { * id : UUID <> -- album_release_id : UUID <> artist_metadata_id : UUID <> track_file_id : UUID <> -- foreign_track_id : TEXT <> foreign_recording_id : TEXT title : TEXT track_number : INT disc_number : INT duration_ms : INT explicit : BOOLEAN ratings : JSONB } entity "track_files" { * id : UUID <> -- album_id : UUID <> -- path : TEXT relative_path : TEXT size : BIGINT quality : JSONB media_info : JSONB audio_tags : JSONB -- scene_name : TEXT release_group : TEXT -- date_added : TIMESTAMPTZ modified_at : TIMESTAMPTZ } } ' ══════════════════════════════════════════════════════════════ ' CONFIGURATION ' ══════════════════════════════════════════════════════════════ package "Configuration" #FFF3E0 { entity "quality_profiles" { * id : UUID <> -- name : TEXT <> cutoff : INT items : JSONB upgrade_allowed : BOOLEAN min_format_score : INT cutoff_format_score : INT } entity "metadata_profiles" { * id : UUID <> -- name : TEXT <> primary_album_types : JSONB secondary_album_types : JSONB release_statuses : JSONB } entity "root_folders" { * id : UUID <> -- name : TEXT path : TEXT <> default_quality_profile_id : UUID <> default_metadata_profile_id : UUID <> default_monitor_option : TEXT default_tags : INT[] } entity "tags" { * id : SERIAL <> -- label : TEXT <> } entity "indexers" { * id : UUID <> -- name : TEXT implementation : TEXT settings : JSONB enable_rss : BOOLEAN enable_search : BOOLEAN priority : INT tags : INT[] } entity "download_clients" { * id : UUID <> -- name : TEXT implementation : TEXT settings : JSONB protocol : TEXT priority : INT remove_completed : BOOLEAN remove_failed : BOOLEAN tags : INT[] enabled : BOOLEAN } } ' ══════════════════════════════════════════════════════════════ ' DOWNLOAD TRACKING ' ══════════════════════════════════════════════════════════════ package "Download Tracking" #E8F5E9 { entity "download_queue" { * id : UUID <> -- artist_id : UUID <> album_id : UUID <> -- download_id : TEXT title : TEXT size : BIGINT size_left : BIGINT time_left : INTERVAL estimated_completion : TIMESTAMPTZ -- status : TEXT state : TEXT status_messages : JSONB -- protocol : TEXT indexer : TEXT download_client : TEXT output_path : TEXT download_forced : BOOLEAN -- added_at : TIMESTAMPTZ } entity "pending_releases" { * id : UUID <> -- artist_id : UUID <> album_id : UUID <> -- title : TEXT release : JSONB parsed_album_info : JSONB reason : TEXT additional_info : JSONB -- added_at : TIMESTAMPTZ } entity "download_history" { * id : UUID <> -- artist_id : UUID <> album_id : UUID <> -- event_type : TEXT download_id : TEXT source_title : TEXT protocol : TEXT indexer_id : UUID download_client_id : UUID release : JSONB data : JSONB -- date : TIMESTAMPTZ } entity "blocklist" { * id : UUID <> -- artist_id : UUID <> album_ids : UUID[] -- source_title : TEXT quality : JSONB size : BIGINT protocol : TEXT indexer : TEXT message : TEXT torrent_hash : TEXT -- published_date : TIMESTAMPTZ date : TIMESTAMPTZ } } ' ══════════════════════════════════════════════════════════════ ' HISTORY & TRACKING ' ══════════════════════════════════════════════════════════════ package "History & Tracking" #FCE4EC { entity "history" { * id : UUID <> -- artist_id : UUID <> album_id : UUID <> track_id : UUID <> -- event_type : TEXT source_title : TEXT quality : JSONB download_id : TEXT data : JSONB -- date : TIMESTAMPTZ } entity "wanted_albums" { ' View/materialized view for missing albums * album_id : UUID <> -- artist_id : UUID title : TEXT release_date : DATE monitored : BOOLEAN track_count : INT track_file_count : INT } } ' ══════════════════════════════════════════════════════════════ ' RELATIONSHIPS ' ══════════════════════════════════════════════════════════════ ' Core music relationships artist_metadata ||--|| artists : "has config" artist_metadata ||--o{ albums : "released" albums ||--o{ album_releases : "has releases" album_releases ||--o{ tracks : "contains" tracks }o--o| track_files : "stored in" track_files }o--|| albums : "belongs to" ' Artist relationships artists }o--|| quality_profiles : "uses" artists }o--o| metadata_profiles : "uses" artists }o--o| root_folders : "stored in" ' Configuration relationships root_folders }o--o| quality_profiles : "default" root_folders }o--o| metadata_profiles : "default" ' Download tracking relationships download_queue }o--o| artists : "for" download_queue }o--o| albums : "for" pending_releases }o--|| artists : "for" pending_releases }o--o| albums : "for" download_history }o--|| artists : "for" download_history }o--o| albums : "for" blocklist }o--|| artists : "for" ' History relationships history }o--|| artists : "for" history }o--o| albums : "for" history }o--o| tracks : "for" @enduml