mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-12-24 01:34:45 +03:00
completely remove sqlitepcl
This commit is contained in:
@@ -3,13 +3,12 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Emby.Server.Implementations.Data;
|
||||
using Jellyfin.Data.Entities.Security;
|
||||
using Jellyfin.Server.Extensions;
|
||||
using Jellyfin.Server.Implementations;
|
||||
using MediaBrowser.Controller;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using Microsoft.Data.Sqlite;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using SQLitePCL.pretty;
|
||||
|
||||
namespace Jellyfin.Server.Migrations.Routines
|
||||
{
|
||||
@@ -57,10 +56,7 @@ namespace Jellyfin.Server.Migrations.Routines
|
||||
public void Perform()
|
||||
{
|
||||
var dataPath = _appPaths.DataPath;
|
||||
using (var connection = SQLite3.Open(
|
||||
Path.Combine(dataPath, DbFilename),
|
||||
ConnectionFlags.ReadOnly,
|
||||
null))
|
||||
using (var connection = new SqliteConnection($"Filename={Path.Combine(dataPath, DbFilename)}"))
|
||||
{
|
||||
using var dbContext = _dbProvider.CreateDbContext();
|
||||
|
||||
@@ -68,23 +64,23 @@ namespace Jellyfin.Server.Migrations.Routines
|
||||
|
||||
foreach (var row in authenticatedDevices)
|
||||
{
|
||||
var dateCreatedStr = row[9].ToString();
|
||||
var dateCreatedStr = row.GetString(9);
|
||||
_ = DateTime.TryParse(dateCreatedStr, out var dateCreated);
|
||||
var dateLastActivityStr = row[10].ToString();
|
||||
var dateLastActivityStr = row.GetString(10);
|
||||
_ = DateTime.TryParse(dateLastActivityStr, out var dateLastActivity);
|
||||
|
||||
if (row[6].IsDbNull())
|
||||
if (row.IsDBNull(6))
|
||||
{
|
||||
dbContext.ApiKeys.Add(new ApiKey(row[3].ToString())
|
||||
dbContext.ApiKeys.Add(new ApiKey(row.GetString(3))
|
||||
{
|
||||
AccessToken = row[1].ToString(),
|
||||
AccessToken = row.GetString(1),
|
||||
DateCreated = dateCreated,
|
||||
DateLastActivity = dateLastActivity
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
var userId = new Guid(row[6].ToString());
|
||||
var userId = row.GetGuid(6);
|
||||
var user = _userManager.GetUserById(userId);
|
||||
if (user is null)
|
||||
{
|
||||
@@ -93,14 +89,14 @@ namespace Jellyfin.Server.Migrations.Routines
|
||||
}
|
||||
|
||||
dbContext.Devices.Add(new Device(
|
||||
new Guid(row[6].ToString()),
|
||||
row[3].ToString(),
|
||||
row[4].ToString(),
|
||||
row[5].ToString(),
|
||||
row[2].ToString())
|
||||
userId,
|
||||
row.GetString(3),
|
||||
row.GetString(4),
|
||||
row.GetString(5),
|
||||
row.GetString(2))
|
||||
{
|
||||
AccessToken = row[1].ToString(),
|
||||
IsActive = row[8].ToBool(),
|
||||
AccessToken = row.GetString(1),
|
||||
IsActive = row.GetBoolean(8),
|
||||
DateCreated = dateCreated,
|
||||
DateLastActivity = dateLastActivity
|
||||
});
|
||||
@@ -111,12 +107,12 @@ namespace Jellyfin.Server.Migrations.Routines
|
||||
var deviceIds = new HashSet<string>();
|
||||
foreach (var row in deviceOptions)
|
||||
{
|
||||
if (row[2].IsDbNull())
|
||||
if (row.IsDBNull(2))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var deviceId = row[2].ToString();
|
||||
var deviceId = row.GetString(2);
|
||||
if (deviceIds.Contains(deviceId))
|
||||
{
|
||||
continue;
|
||||
@@ -126,7 +122,7 @@ namespace Jellyfin.Server.Migrations.Routines
|
||||
|
||||
dbContext.DeviceOptions.Add(new DeviceOptions(deviceId)
|
||||
{
|
||||
CustomName = row[1].IsDbNull() ? null : row[1].ToString()
|
||||
CustomName = row.IsDBNull(1) ? null : row.GetString(1)
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user