From 290463fe7b464ad5218a1b5646891be453bcc458 Mon Sep 17 00:00:00 2001 From: David Federman Date: Wed, 11 Feb 2026 23:35:59 -0800 Subject: [PATCH] Fix migration UNIQUE constraint on BaseItemProviders Deduplicate ProviderIds by ProviderId during MigrateLibraryDb migration to prevent UNIQUE constraint violations when legacy data contains duplicate provider entries for the same item. Fixes #16134 --- Jellyfin.Server/Migrations/Routines/MigrateLibraryDb.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Jellyfin.Server/Migrations/Routines/MigrateLibraryDb.cs b/Jellyfin.Server/Migrations/Routines/MigrateLibraryDb.cs index d221d18531..59b7e143c1 100644 --- a/Jellyfin.Server/Migrations/Routines/MigrateLibraryDb.cs +++ b/Jellyfin.Server/Migrations/Routines/MigrateLibraryDb.cs @@ -1163,7 +1163,9 @@ internal class MigrateLibraryDb : IDatabaseMigrationRoutine Item = null!, ProviderId = e[0], ProviderValue = string.Join('|', e.Skip(1)) - }).ToArray(); + }) + .DistinctBy(e => e.ProviderId) + .ToArray(); } if (reader.TryGetString(index++, out var imageInfos))