aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Server/Migrations/Routines/MigrateAuthenticationDb.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Jellyfin.Server/Migrations/Routines/MigrateAuthenticationDb.cs')
-rw-r--r--Jellyfin.Server/Migrations/Routines/MigrateAuthenticationDb.cs28
1 files changed, 26 insertions, 2 deletions
diff --git a/Jellyfin.Server/Migrations/Routines/MigrateAuthenticationDb.cs b/Jellyfin.Server/Migrations/Routines/MigrateAuthenticationDb.cs
index 6c9ad0338..21f153623 100644
--- a/Jellyfin.Server/Migrations/Routines/MigrateAuthenticationDb.cs
+++ b/Jellyfin.Server/Migrations/Routines/MigrateAuthenticationDb.cs
@@ -1,4 +1,5 @@
using System;
+using System.Collections.Generic;
using System.IO;
using Emby.Server.Implementations.Data;
using Jellyfin.Data.Entities.Security;
@@ -53,9 +54,9 @@ namespace Jellyfin.Server.Migrations.Routines
{
using var dbContext = _dbProvider.CreateContext();
- var queryResult = connection.Query("SELECT * FROM Tokens");
+ var authenticatedDevices = connection.Query("SELECT * FROM Tokens");
- foreach (var row in queryResult)
+ foreach (var row in authenticatedDevices)
{
if (row[6].IsDbNull())
{
@@ -83,6 +84,29 @@ namespace Jellyfin.Server.Migrations.Routines
}
}
+ var deviceOptions = connection.Query("SELECT * FROM Devices");
+ var deviceIds = new HashSet<string>();
+ foreach (var row in deviceOptions)
+ {
+ if (row[2].IsDbNull())
+ {
+ continue;
+ }
+
+ var deviceId = row[2].ToString();
+ if (deviceIds.Contains(deviceId))
+ {
+ continue;
+ }
+
+ deviceIds.Add(deviceId);
+
+ dbContext.DeviceOptions.Add(new DeviceOptions(deviceId)
+ {
+ CustomName = row[1].IsDbNull() ? null : row[1].ToString()
+ });
+ }
+
dbContext.SaveChanges();
}