From edec464306b8cba2177098042c2d57429853fd8d Mon Sep 17 00:00:00 2001 From: Shadowghost Date: Mon, 9 Feb 2026 18:25:07 +0100 Subject: [PATCH] Handle episode versions in LinkedChild migration --- .../Migrations/Routines/MigrateLinkedChildren.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Jellyfin.Server/Migrations/Routines/MigrateLinkedChildren.cs b/Jellyfin.Server/Migrations/Routines/MigrateLinkedChildren.cs index c1de002e38..82402cd88e 100644 --- a/Jellyfin.Server/Migrations/Routines/MigrateLinkedChildren.cs +++ b/Jellyfin.Server/Migrations/Routines/MigrateLinkedChildren.cs @@ -48,7 +48,8 @@ internal class MigrateLinkedChildren : IDatabaseMigrationRoutine var videoTypes = new[] { "MediaBrowser.Controller.Entities.Video", - "MediaBrowser.Controller.Entities.Movies.Movie" + "MediaBrowser.Controller.Entities.Movies.Movie", + "MediaBrowser.Controller.Entities.TV.Episode" }; var itemsWithData = context.BaseItems @@ -78,7 +79,7 @@ internal class MigrateLinkedChildren : IDatabaseMigrationRoutine { using var doc = JsonDocument.Parse(item.Data); - var isVideo = item.Type == "MediaBrowser.Controller.Entities.Video" || item.Type == "MediaBrowser.Controller.Entities.Movies.Movie"; + var isVideo = videoTypes.Contains(item.Type); // Handle Video alternate versions if (isVideo) @@ -235,8 +236,6 @@ internal class MigrateLinkedChildren : IDatabaseMigrationRoutine // but the parent is a more specific type (like Movie). // Since IDs are computed from type + path, just updating the Type column would break ID lookups. // Instead, delete them and let the runtime recreate them with the correct type during the next library scan. - var genericVideoType = "MediaBrowser.Controller.Entities.Video"; - var wrongTypeChildIds = context.LinkedChildren .Where(lc => lc.ChildType == LinkedChildType.LocalAlternateVersion) .Join( @@ -249,7 +248,7 @@ internal class MigrateLinkedChildren : IDatabaseMigrationRoutine x => x.ChildId, child => child.Id, (x, child) => new { x.ChildId, x.ParentType, ChildType = child.Type }) - .Where(x => x.ChildType == genericVideoType && x.ParentType != genericVideoType) + .Where(x => x.ChildType != x.ParentType) .Select(x => x.ChildId) .Distinct() .ToList();