navidrome/db/migrations
Deluan Quintão 758e64c999
feat(scanner): per-library PID configuration (#6252)
* feat(model): add per-library PID config columns

* refactor(metadata): pass PID config to ToMediaFile and add spec validation

* feat(scanner): rescan only libraries whose PID config changed

* feat(server): validate library PID config and rescan on change

* feat(ui): edit per-library PID config

* fix(ui): label the PID mode selects

* fix: tighten per-library PID rescan edge cases

An interrupted PID rescan no longer upgrades every library to a full scan, a save that loses the race for the scanner logs at debug, the confirm dialog only shows when the effective PID spec changes, and it now gets translation keys.

* refactor(metadata): pass the library to ToMediaFile

ToMediaFile and core.Inspect took the library ID and its PID config as
separate arguments, so a caller could mix values from two libraries. They
now take the model.Library and resolve the effective PID config from it.

* chore: tidy per-library PID comments, PropTypes and migration

Trim comments that restated the code, add PropTypes to the new UI
components, and recreate the migration with make migration-sql.

* fix(ui): show the PID spec help under its input

* feat(cmd): make inspect use the file's library PID config

inspect always used the global PID config, so it showed different IDs than
the scanner for files in a library with an override. It now finds the
file's library in the DB and uses its effective config, falling back to
the global config when there is no DB or the file is outside every
library. It never creates a DB. The library path matcher moves from
core/playlists to model so both can use it.

* refactor: simplify per-library PID code

Share the DB-file check between CLI commands, move ErrAlreadyScanning to
model so core no longer imports scanner, read the libraries once for
insights, and let ValidatePIDSpec accept an empty spec and look tags up
directly. In the scanner, use FullScanInProgress instead of a second
flag, and skip recomputing album IDs when the album spec did not change.
In the UI, share the PID inputs between Create and Edit, and use docsUrl.

* feat(ui): add section titles to Library Create and pre-fill Custom PID specs

Custom now starts from the global spec, so admins edit a working spec
instead of typing one from scratch.

* fix(inspect): map files with the library-relative path the scanner uses

Inspect gave metadata the file's directory as typed, so folder-based PIDs
never matched the DB. It now uses the path relative to the library root,
through the scanner's helper, which moves to model.

* fix(scanner): say when a PID rescan only covers target folders

* fix: reject tag aliases in album PID specs and match root libraries

Tags are stored under canonical names, so an alias in a spec always reads
as empty. In an album spec that gives every album the same ID, so album
specs now require the tag name. Track specs keep accepting aliases, since
the default one uses them. LibraryMatcher now matches paths under a
library at the filesystem root.

* refactor(model): move the tag alias lookup to tag_mappings.go

* test: run the library matcher and inspect tests on Windows

Build test paths with filepath instead of Unix literals, so they use the
OS separator like filepath.Abs output, and drop the Windows skips.

* feat(ui): add pt-BR translations for per-library PID settings
2026-10-02 05:05:32 -04:00
..
20200130083147_create_schema.go
20200131183653_standardize_item_type.go
20200208222418_add_defaults_to_annotations.go
20200220143731_change_duration_to_float.go
20200310171621_enable_search_by_albumartist.go
20200310181627_add_transcoding_and_player_tables.go
20200319211049_merge_search_into_main_tables.go
20200325185135_add_album_artist_id.go
20200326090707_fix_album_artists_importing.go
20200327193744_add_year_range_to_album.go
20200404214704_add_indexes.go
20200409002249_enable_search_by_tracks_artists.go
20200411164603_add_created_and_updated_fields_to_playlists.go
20200418110522_reindex_to_fix_album_years.go
20200419222708_reindex_to_change_full_text_search.go
20200423204116_add_sort_fields.go
20200508093059_add_artist_song_count.go
20200512104202_add_disc_subtitle.go
20200516140647_add_playlist_tracks_table.go
20200608153717_referential_integrity.go
20200706231659_add_default_transcodings.go
20200710211442_add_playlist_path.go
20200731095603_create_play_queues_table.go
20200801101355_create_bookmark_table.go
20200819111809_drop_email_unique_constraint.go
20201003111749_add_starred_at_index.go
20201010162350_add_album_size.go
20201012210022_add_artist_playlist_size.go
20201021085410_add_mbids.go
20201021093209_add_media_file_indexes.go
20201021135455_add_media_file_artist_index.go
20201030162009_add_artist_info_table.go
20201110205344_add_comments_and_lyrics.go
20201128100726_add_real-path_option.go
20201213124814_add_all_artist_ids_to_album.go
20210322132848_add_timestamp_indexes.go
20210418232815_fix_album_comments.go
20210430212322_add_bpm_metadata.go
20210530121921_create_shares_table.go
20210601231734_update_share_fieldnames.go
20210616150710_encrypt_all_passwords.go
20210619231716_drop_player_name_unique_constraint.go
20210623155401_add_user_prefs_player_scrobbler_enabled.go
20210625223901_add_referential_integrity_to_user_props.go
20210626213026_add_scrobble_buffer.go
20210715151153_add_genre_tables.go
20210821212604_add_mediafile_channels.go
20211008205505_add_smart_playlist.go
20211023184825_add_order_title_to_media_file.go
20211026191915_unescape_lyrics_and_comments.go
20211029213200_add_userid_to_playlist.go
20211102215414_add_alphabetical_by_artist_index.go
20211105162746_remove_invalid_artist_ids.go
20220724231849_add_musicbrainz_release_track_id.go
20221219112733_add_album_image_paths.go
20221219140528_remove_cover_art_id.go
20230112111457_add_album_paths.go
20230114121537_touch_playlists.go
20230115103212_create_internet_radio.go
20230117155559_add_replaygain_metadata.go
20230117180400_add_album_info.go
20230119152657_recreate_share_table.go
20230202143713_change_path_list_separator.go
20230209181414_change_image_files_list_separator.go
20230310222612_add_download_to_share.go
20230404104309_empty_sql_migration.sql
20230515184510_add_release_date.go
20230616214944_rename_musicbrainz_recording_id.go
20231208182311_add_discs_to_album.go
20231209211223_alter_lyric_column.go
20240122223340_add_default_values_to_null_columns.go.go
20240426202913_add_id_to_scrobble_buffer.go
20240511210036_add_sample_rate.go
20240511220020_add_library_table.go fix: miscellaneous fixes for shares, artwork resize, auth limits, and watcher start (#6098) 2026-09-11 15:03:54 -04:00
20240629152843_remove_annotation_id.go
20240802044339_player_use_user_id_over_username.go
20241020003138_add_sort_tags_index.sql
20241024125533_fix_sort_tags_collation_and_index.sql
20241026183640_support_new_scanner.go
20250522013904_share_user_id_on_delete.sql
20250611010101_playqueue_current_to_index.go
20250701010101_add_folder_hash.go
20250701010102_add_annotation_user_foreign_key.sql
20250701010103_add_library_stats.go
20250701010104_make_replaygain_fields_nullable.go
20250701010105_remove_dangling_items.sql
20250701010106_add_participant_stats_to_all_artists.sql
20250701010107_add_mbid_indexes.sql
20250701010108_add_multi_library_support.go
20250823142158_make_playqueue_position_int.sql
20251109010105_add_annotation_rating_date.sql
20251206013022_create_scrobbles_table.sql
20260104203627_playlist_case_insensitive_name.sql
20260106000620_create_plugin_table.sql
20260117201522_add_avg_rating_column.sql
20260220173400_add_fts5_search.go
20260228020813_add_plugin_allow_write_access.sql
20260228172956_add_playlist_image_file.go
20260302021413_rename_playlist_image_fields.go
20260307175815_add_codec_and_update_transcodings.go
20260309120007_fix_probe_data_null.go
20260309203355_ensure_default_transcodings.go
20260310113858_fix_aac_transcode_command.go
20260315233131_add_artist_uploaded_image.go
20260316000000_normalize_timestamps.sql
20260318182414_add_radio_uploaded_image.go
20260405124200_fix_schema_inconsistencies.sql
20260410201914_fix_zero_album_created_at.sql
20260513173954_move_ss_before_input.go
20260520211813_add_media_file_artists_composite_index.sql
20260612171826_add_media_file_missing_library_id_index.sql
20260612222838_make_bpm_bitdepth_nullable.sql
20260618120509_add_metadata_to_default_transcodings.go
20260629123100_recently_added_plain_indexes.sql
20260702152457_backfill_artist_search_normalized.go
20260703013908_optimize_media_file_sort_indexes.sql
20260712211040_add_primary_key_and_update_index_for_scrobbles.sql
20260714120000_add_playlist_average_rating.sql
20260714123822_add_media_file_title_sort_covering_index.sql
20260719005427_add_album_replaygain.go
20260720015443_uniform_canonical_ids.go
20260722023032_add_artwork_tables.sql
20260810143445_reorder_album_artists_unique_constraint.sql
20260811023338_add_item_genre_tag_indexes.sql
20260815015320_add_user_scrobble_filter.sql
20260816180040_renormalize_album_created_at.sql
20260818002312_add_playlist_imported_hash.sql
20260819204637_add_artwork_trace_columns.sql
20260822062750_add_user_token_epoch.sql
20260901225726_normalize_artwork_last_failure.sql
20260922230428_clamp_media_file_int32_tag_numbers.sql fix(scanner): keep tag numbers within the int32 range (#6202) 2026-09-22 19:51:32 -04:00
20260924010054_add_player_api_key_hash.sql feat(subsonic): OpenSubsonic API key authentication (#6219) 2026-09-27 21:56:58 -04:00
20260929221042_add_library_pid_columns.sql feat(scanner): per-library PID configuration (#6252) 2026-10-02 05:05:32 -04:00
id_canonical_test.go
id_columns_guard_test.go
migration.go
migrations_suite_test.go
uniform_canonical_ids_test.go