mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-09 03:04:24 -04:00
Fix the migration as the new constraint now uses Value as unique key (#13867)
This commit is contained in:
parent
82a561b87d
commit
77ad7f6139
@ -138,14 +138,14 @@ internal class MigrateLibraryDb : IDatabaseMigrationRoutine
|
|||||||
""";
|
""";
|
||||||
|
|
||||||
// EFCores local lookup sucks. We cannot use context.ItemValues.Local here because its just super slow.
|
// EFCores local lookup sucks. We cannot use context.ItemValues.Local here because its just super slow.
|
||||||
var localItems = new Dictionary<(int Type, string CleanValue), (Database.Implementations.Entities.ItemValue ItemValue, List<Guid> ItemIds)>();
|
var localItems = new Dictionary<(int Type, string Value), (Database.Implementations.Entities.ItemValue ItemValue, List<Guid> ItemIds)>();
|
||||||
using (new TrackedMigrationStep("loading ItemValues", _logger))
|
using (new TrackedMigrationStep("loading ItemValues", _logger))
|
||||||
{
|
{
|
||||||
foreach (SqliteDataReader dto in connection.Query(itemValueQuery))
|
foreach (SqliteDataReader dto in connection.Query(itemValueQuery))
|
||||||
{
|
{
|
||||||
var itemId = dto.GetGuid(0);
|
var itemId = dto.GetGuid(0);
|
||||||
var entity = GetItemValue(dto);
|
var entity = GetItemValue(dto);
|
||||||
var key = ((int)entity.Type, entity.CleanValue);
|
var key = ((int)entity.Type, entity.Value);
|
||||||
if (!localItems.TryGetValue(key, out var existing))
|
if (!localItems.TryGetValue(key, out var existing))
|
||||||
{
|
{
|
||||||
localItems[key] = existing = (entity, []);
|
localItems[key] = existing = (entity, []);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user