aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Server/Migrations/Routines/MigrateActivityLogDb.cs
diff options
context:
space:
mode:
authorPatrick Barron <barronpm@gmail.com>2020-05-12 12:50:17 -0400
committerPatrick Barron <barronpm@gmail.com>2020-05-12 12:50:17 -0400
commitbac4bf96a0e642f80f35bd6cdf3de17a9302b6c6 (patch)
treee8a42f31f5bc0a97e43115679617fc02c4c02105 /Jellyfin.Server/Migrations/Routines/MigrateActivityLogDb.cs
parent6379391f871424177c6048a54ccd061d6e44bc4a (diff)
Fix build errors
Diffstat (limited to 'Jellyfin.Server/Migrations/Routines/MigrateActivityLogDb.cs')
-rw-r--r--Jellyfin.Server/Migrations/Routines/MigrateActivityLogDb.cs23
1 files changed, 17 insertions, 6 deletions
diff --git a/Jellyfin.Server/Migrations/Routines/MigrateActivityLogDb.cs b/Jellyfin.Server/Migrations/Routines/MigrateActivityLogDb.cs
index 9f1f5b92e..fe7ef01ee 100644
--- a/Jellyfin.Server/Migrations/Routines/MigrateActivityLogDb.cs
+++ b/Jellyfin.Server/Migrations/Routines/MigrateActivityLogDb.cs
@@ -5,8 +5,8 @@ using System.IO;
using Emby.Server.Implementations.Data;
using Jellyfin.Data.Entities;
using Jellyfin.Server.Implementations;
+using MediaBrowser.Controller;
using Microsoft.EntityFrameworkCore;
-using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using SQLitePCL.pretty;
@@ -16,20 +16,31 @@ namespace Jellyfin.Server.Migrations.Routines
{
private const string DbFilename = "activitylog.db";
+ private readonly ILogger<MigrateActivityLogDb> _logger;
+ private readonly JellyfinDbProvider _provider;
+ private readonly IServerApplicationPaths _paths;
+
+ public MigrateActivityLogDb(ILogger<MigrateActivityLogDb> logger, IServerApplicationPaths paths, JellyfinDbProvider provider)
+ {
+ _logger = logger;
+ _provider = provider;
+ _paths = paths;
+ }
+
public Guid Id => Guid.Parse("3793eb59-bc8c-456c-8b9f-bd5a62a42978");
public string Name => "MigrateActivityLogDatabase";
- public void Perform(CoreAppHost host, ILogger logger)
+ public void Perform()
{
- var dataPath = host.ServerConfigurationManager.ApplicationPaths.DataPath;
+ var dataPath = _paths.DataPath;
using (var connection = SQLite3.Open(
Path.Combine(dataPath, DbFilename),
ConnectionFlags.ReadOnly,
null))
{
- logger.LogInformation("Migrating the database may take a while, do not stop Jellyfin.");
- using var dbContext = host.ServiceProvider.GetService<JellyfinDb>();
+ _logger.LogInformation("Migrating the database may take a while, do not stop Jellyfin.");
+ using var dbContext = _provider.CreateContext();
var queryResult = connection.Query("SELECT * FROM ActivityLog ORDER BY Id ASC");
@@ -75,7 +86,7 @@ namespace Jellyfin.Server.Migrations.Routines
}
catch (IOException e)
{
- logger.LogError(e, "Error renaming legacy activity log database to 'activitylog.db.old'");
+ _logger.LogError(e, "Error renaming legacy activity log database to 'activitylog.db.old'");
}
}