@startuml 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 - 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 -- 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 } entity "albums" { * id : UUID <> -- artist_metadata_id : UUID <> -- foreign_album_id : TEXT <> title : TEXT clean_title : TEXT disambiguation : TEXT overview : TEXT album_type : TEXT release_date : DATE images : JSONB genres : JSONB -- monitored : BOOLEAN added_at : TIMESTAMPTZ } entity "album_releases" { * id : UUID <> -- album_id : UUID <> -- foreign_release_id : TEXT <> title : TEXT status : TEXT duration_ms : INT release_date : DATE country : TEXT[] label : TEXT[] format : TEXT 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 <> title : TEXT track_number : INT disc_number : INT duration_ms : INT explicit : BOOLEAN } entity "track_files" { * id : UUID <> -- album_id : UUID <> -- path : TEXT relative_path : TEXT size : BIGINT -- file_hash : TEXT audio_hash : TEXT -- quality : JSONB media_info : JSONB -- scene_name : TEXT release_group : TEXT -- date_added : TIMESTAMPTZ } } ' ══════════════════════════════════════════════════════════════ ' CONFIGURATION ' ══════════════════════════════════════════════════════════════ package "Configuration" #FFF3E0 { entity "quality_profiles" { * id : UUID <> -- name : TEXT <> cutoff : INT items : JSONB upgrade_allowed : BOOLEAN } 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 <> } entity "indexers" { * id : UUID <> -- name : TEXT implementation : TEXT settings : JSONB enable_rss : BOOLEAN enable_search : BOOLEAN priority : INT } entity "download_clients" { * id : UUID <> -- name : TEXT implementation : TEXT settings : JSONB protocol : TEXT priority : INT enabled : BOOLEAN } } ' ══════════════════════════════════════════════════════════════ ' DOWNLOAD TRACKING ' ══════════════════════════════════════════════════════════════ package "Download Tracking" #E8F5E9 { entity "wanted_albums" { * id : UUID <> -- album_id : UUID <> <> -- priority : INT search_count : INT last_searched_at : TIMESTAMPTZ added_at : TIMESTAMPTZ } entity "download_queue" { * id : UUID <> -- artist_id : UUID <> album_id : UUID <> -- download_id : TEXT title : TEXT size : BIGINT size_left : BIGINT -- status : TEXT progress : REAL error_message : TEXT -- protocol : TEXT indexer : TEXT download_client : TEXT torrent_hash : TEXT output_path : TEXT -- added_at : TIMESTAMPTZ completed_at : TIMESTAMPTZ } entity "blocklist" { * id : UUID <> -- artist_id : UUID <> album_id : UUID <> -- source_title : TEXT quality : JSONB size : BIGINT protocol : TEXT indexer : TEXT message : TEXT torrent_hash : TEXT -- date : TIMESTAMPTZ } } ' ══════════════════════════════════════════════════════════════ ' 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 config relationships artists }o--|| quality_profiles : "uses" artists }o--o| metadata_profiles : "uses" artists }o--o| root_folders : "stored in" ' Root folder defaults root_folders }o--o| quality_profiles : "default" root_folders }o--o| metadata_profiles : "default" ' Download tracking relationships wanted_albums ||--|| albums : "targets" download_queue }o--o| artists : "for" download_queue }o--o| albums : "for" blocklist }o--|| artists : "for" blocklist }o--o| albums : "for" @enduml