Deluan Quintão 39febfac28 fix(scanner): prevent foreign key constraint errors in album participant insertion (#4373)
* fix: prevent foreign key constraint error in album participants

Prevent foreign key constraint errors when album participants contain
artist IDs that don't exist in the artist table. The updateParticipants
method now filters out non-existent artist IDs before attempting to
insert album_artists relationships.

- Add defensive filtering in updateParticipants() to query existing artist IDs
- Only insert relationships for artist IDs that exist in the artist table
- Add comprehensive regression test for both albums and media files
- Fixes scanner errors when JSON participant data contains stale artist references

Signed-off-by: Deluan <deluan@navidrome.org>

* fix: optimize foreign key handling in album artists insertion

Signed-off-by: Deluan <deluan@navidrome.org>

* fix: improve participants foreign key tests

Signed-off-by: Deluan <deluan@navidrome.org>

* fix: clarify comments in album artists insertion query

Signed-off-by: Deluan <deluan@navidrome.org>

* test: add cleanup to album repository tests

Added individual test cleanup to 4 album repository tests that create temporary
artists and albums. This ensures proper test isolation by removing test data
after each test completes, preventing test interference when running with
shuffle mode. Each test now cleans up its own temporary data from the artist,
library_artist, album, and album_artists tables using direct SQL deletion.

Signed-off-by: Deluan <deluan@navidrome.org>

* fix: refactor participant JSON handling for simpler and improved SQL processing

Signed-off-by: Deluan <deluan@navidrome.org>

* fix: update test command description in Makefile for clarity

Signed-off-by: Deluan <deluan@navidrome.org>

* fix: refactor album repository tests to use albumRepository type directly

Signed-off-by: Deluan <deluan@navidrome.org>

---------

Signed-off-by: Deluan <deluan@navidrome.org>
2025-07-22 14:35:12 -04:00
2025-07-18 18:41:12 -04:00
2025-07-18 18:41:12 -04:00
2025-07-18 18:41:12 -04:00
2025-07-18 18:41:12 -04:00
2025-06-28 20:01:47 -04:00
2024-02-16 20:29:16 -05:00
2025-07-20 13:36:46 -04:00
2020-01-22 14:48:38 -05:00

Navidrome logo

Navidrome Music Server  Tweet

Last Release Build Downloads Docker Pulls Dev Chat Subreddit Contributor Covenant Gurubase

Navidrome is an open source web-based music collection server and streamer. It gives you freedom to listen to your music collection from any browser or mobile device. It's like your personal Spotify!

Note: The master branch may be in an unstable or even broken state during development. Please use releases instead of the master branch in order to get a stable set of binaries.

Check out our Live Demo!

Any feedback is welcome! If you need/want a new feature, find a bug or think of any way to improve Navidrome, please file a GitHub issue or join the discussion in our Subreddit. If you want to contribute to the project in any other way (ui/backend dev, translations, themes), please join the chat in our Discord server.

Installation

See instructions on the project's website

Cloud Hosting

PikaPods has partnered with us to offer you an officially supported, cloud-hosted solution. A share of the revenue helps fund the development of Navidrome at no additional cost for you.

PikaPods

Features

  • Handles very large music collections
  • Streams virtually any audio format available
  • Reads and uses all your beautifully curated metadata
  • Great support for compilations (Various Artists albums) and box sets (multi-disc albums)
  • Multi-user, each user has their own play counts, playlists, favourites, etc...
  • Very low resource usage
  • Multi-platform, runs on macOS, Linux and Windows. Docker images are also provided
  • Ready to use binaries for all major platforms, including Raspberry Pi
  • Automatically monitors your library for changes, importing new files and reloading new metadata
  • Themeable, modern and responsive Web interface based on Material UI
  • Compatible with all Subsonic/Madsonic/Airsonic clients
  • Transcoding on the fly. Can be set per user/player. Opus encoding is supported
  • Translated to various languages

Translations

Navidrome uses POEditor for translations, and we are always looking for more contributors

Documentation

All documentation can be found in the project's website: https://www.navidrome.org/docs. Here are some useful direct links:

Screenshots

Description
No description provided
Readme 98 MiB
Languages
Go 76.5%
JavaScript 22.3%
Makefile 0.4%
C++ 0.3%
Shell 0.2%
Other 0.2%