Rename JellyfinDb to JellyfinDbContext
This commit is contained in:
parent
3f66a48206
commit
8479f0f90c
|
@ -654,7 +654,7 @@ namespace Emby.Server.Implementations
|
||||||
/// <returns>A task representing the service initialization operation.</returns>
|
/// <returns>A task representing the service initialization operation.</returns>
|
||||||
public async Task InitializeServices()
|
public async Task InitializeServices()
|
||||||
{
|
{
|
||||||
var jellyfinDb = await Resolve<IDbContextFactory<JellyfinDb>>().CreateDbContextAsync().ConfigureAwait(false);
|
var jellyfinDb = await Resolve<IDbContextFactory<JellyfinDbContext>>().CreateDbContextAsync().ConfigureAwait(false);
|
||||||
await using (jellyfinDb.ConfigureAwait(false))
|
await using (jellyfinDb.ConfigureAwait(false))
|
||||||
{
|
{
|
||||||
if ((await jellyfinDb.Database.GetPendingMigrationsAsync().ConfigureAwait(false)).Any())
|
if ((await jellyfinDb.Database.GetPendingMigrationsAsync().ConfigureAwait(false)).Any())
|
||||||
|
|
|
@ -17,7 +17,7 @@ namespace Emby.Server.Implementations.ScheduledTasks.Tasks
|
||||||
{
|
{
|
||||||
private readonly ILogger<OptimizeDatabaseTask> _logger;
|
private readonly ILogger<OptimizeDatabaseTask> _logger;
|
||||||
private readonly ILocalizationManager _localization;
|
private readonly ILocalizationManager _localization;
|
||||||
private readonly IDbContextFactory<JellyfinDb> _provider;
|
private readonly IDbContextFactory<JellyfinDbContext> _provider;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="OptimizeDatabaseTask" /> class.
|
/// Initializes a new instance of the <see cref="OptimizeDatabaseTask" /> class.
|
||||||
|
@ -28,7 +28,7 @@ namespace Emby.Server.Implementations.ScheduledTasks.Tasks
|
||||||
public OptimizeDatabaseTask(
|
public OptimizeDatabaseTask(
|
||||||
ILogger<OptimizeDatabaseTask> logger,
|
ILogger<OptimizeDatabaseTask> logger,
|
||||||
ILocalizationManager localization,
|
ILocalizationManager localization,
|
||||||
IDbContextFactory<JellyfinDb> provider)
|
IDbContextFactory<JellyfinDbContext> provider)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_localization = localization;
|
_localization = localization;
|
||||||
|
|
|
@ -15,13 +15,13 @@ namespace Jellyfin.Server.Implementations.Activity
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class ActivityManager : IActivityManager
|
public class ActivityManager : IActivityManager
|
||||||
{
|
{
|
||||||
private readonly IDbContextFactory<JellyfinDb> _provider;
|
private readonly IDbContextFactory<JellyfinDbContext> _provider;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="ActivityManager"/> class.
|
/// Initializes a new instance of the <see cref="ActivityManager"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="provider">The Jellyfin database provider.</param>
|
/// <param name="provider">The Jellyfin database provider.</param>
|
||||||
public ActivityManager(IDbContextFactory<JellyfinDb> provider)
|
public ActivityManager(IDbContextFactory<JellyfinDbContext> provider)
|
||||||
{
|
{
|
||||||
_provider = provider;
|
_provider = provider;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ namespace Jellyfin.Server.Implementations.Devices
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class DeviceManager : IDeviceManager
|
public class DeviceManager : IDeviceManager
|
||||||
{
|
{
|
||||||
private readonly IDbContextFactory<JellyfinDb> _dbProvider;
|
private readonly IDbContextFactory<JellyfinDbContext> _dbProvider;
|
||||||
private readonly IUserManager _userManager;
|
private readonly IUserManager _userManager;
|
||||||
private readonly ConcurrentDictionary<string, ClientCapabilities> _capabilitiesMap = new();
|
private readonly ConcurrentDictionary<string, ClientCapabilities> _capabilitiesMap = new();
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ namespace Jellyfin.Server.Implementations.Devices
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="dbProvider">The database provider.</param>
|
/// <param name="dbProvider">The database provider.</param>
|
||||||
/// <param name="userManager">The user manager.</param>
|
/// <param name="userManager">The user manager.</param>
|
||||||
public DeviceManager(IDbContextFactory<JellyfinDb> dbProvider, IUserManager userManager)
|
public DeviceManager(IDbContextFactory<JellyfinDbContext> dbProvider, IUserManager userManager)
|
||||||
{
|
{
|
||||||
_dbProvider = dbProvider;
|
_dbProvider = dbProvider;
|
||||||
_userManager = userManager;
|
_userManager = userManager;
|
||||||
|
|
|
@ -29,7 +29,7 @@ public static class ServiceCollectionExtensions
|
||||||
.SkipCachingResults(result =>
|
.SkipCachingResults(result =>
|
||||||
result.Value is null || (result.Value is EFTableRows rows && rows.RowsCount == 0)));
|
result.Value is null || (result.Value is EFTableRows rows && rows.RowsCount == 0)));
|
||||||
|
|
||||||
serviceCollection.AddPooledDbContextFactory<JellyfinDb>((serviceProvider, opt) =>
|
serviceCollection.AddPooledDbContextFactory<JellyfinDbContext>((serviceProvider, opt) =>
|
||||||
{
|
{
|
||||||
var applicationPaths = serviceProvider.GetRequiredService<IApplicationPaths>();
|
var applicationPaths = serviceProvider.GetRequiredService<IApplicationPaths>();
|
||||||
var loggerFactory = serviceProvider.GetRequiredService<ILoggerFactory>();
|
var loggerFactory = serviceProvider.GetRequiredService<ILoggerFactory>();
|
||||||
|
|
|
@ -8,13 +8,13 @@ using Microsoft.EntityFrameworkCore;
|
||||||
namespace Jellyfin.Server.Implementations;
|
namespace Jellyfin.Server.Implementations;
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public class JellyfinDb : DbContext
|
public class JellyfinDbContext : DbContext
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="JellyfinDb"/> class.
|
/// Initializes a new instance of the <see cref="JellyfinDbContext"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="options">The database context options.</param>
|
/// <param name="options">The database context options.</param>
|
||||||
public JellyfinDb(DbContextOptions<JellyfinDb> options) : base(options)
|
public JellyfinDbContext(DbContextOptions<JellyfinDbContext> options) : base(options)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,6 +183,6 @@ public class JellyfinDb : DbContext
|
||||||
base.OnModelCreating(modelBuilder);
|
base.OnModelCreating(modelBuilder);
|
||||||
|
|
||||||
// Configuration for each entity is in it's own class inside 'ModelConfiguration'.
|
// Configuration for each entity is in it's own class inside 'ModelConfiguration'.
|
||||||
modelBuilder.ApplyConfigurationsFromAssembly(typeof(JellyfinDb).Assembly);
|
modelBuilder.ApplyConfigurationsFromAssembly(typeof(JellyfinDbContext).Assembly);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -10,7 +10,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
|
||||||
namespace Jellyfin.Server.Implementations.Migrations
|
namespace Jellyfin.Server.Implementations.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(JellyfinDb))]
|
[DbContext(typeof(JellyfinDbContext))]
|
||||||
[Migration("20200514181226_AddActivityLog")]
|
[Migration("20200514181226_AddActivityLog")]
|
||||||
partial class AddActivityLog
|
partial class AddActivityLog
|
||||||
{
|
{
|
||||||
|
|
|
@ -10,7 +10,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
|
||||||
namespace Jellyfin.Server.Implementations.Migrations
|
namespace Jellyfin.Server.Implementations.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(JellyfinDb))]
|
[DbContext(typeof(JellyfinDbContext))]
|
||||||
[Migration("20200613202153_AddUsers")]
|
[Migration("20200613202153_AddUsers")]
|
||||||
partial class AddUsers
|
partial class AddUsers
|
||||||
{
|
{
|
||||||
|
|
|
@ -10,7 +10,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
|
||||||
namespace Jellyfin.Server.Implementations.Migrations
|
namespace Jellyfin.Server.Implementations.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(JellyfinDb))]
|
[DbContext(typeof(JellyfinDbContext))]
|
||||||
[Migration("20200728005145_AddDisplayPreferences")]
|
[Migration("20200728005145_AddDisplayPreferences")]
|
||||||
partial class AddDisplayPreferences
|
partial class AddDisplayPreferences
|
||||||
{
|
{
|
||||||
|
|
|
@ -10,7 +10,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
|
||||||
namespace Jellyfin.Server.Implementations.Migrations
|
namespace Jellyfin.Server.Implementations.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(JellyfinDb))]
|
[DbContext(typeof(JellyfinDbContext))]
|
||||||
[Migration("20200905220533_FixDisplayPreferencesIndex")]
|
[Migration("20200905220533_FixDisplayPreferencesIndex")]
|
||||||
partial class FixDisplayPreferencesIndex
|
partial class FixDisplayPreferencesIndex
|
||||||
{
|
{
|
||||||
|
|
|
@ -10,7 +10,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
|
||||||
namespace Jellyfin.Server.Implementations.Migrations
|
namespace Jellyfin.Server.Implementations.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(JellyfinDb))]
|
[DbContext(typeof(JellyfinDbContext))]
|
||||||
[Migration("20201004171403_AddMaxActiveSessions")]
|
[Migration("20201004171403_AddMaxActiveSessions")]
|
||||||
partial class AddMaxActiveSessions
|
partial class AddMaxActiveSessions
|
||||||
{
|
{
|
||||||
|
|
|
@ -9,7 +9,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
|
||||||
namespace Jellyfin.Server.Implementations.Migrations
|
namespace Jellyfin.Server.Implementations.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(JellyfinDb))]
|
[DbContext(typeof(JellyfinDbContext))]
|
||||||
[Migration("20201204223655_AddCustomDisplayPreferences")]
|
[Migration("20201204223655_AddCustomDisplayPreferences")]
|
||||||
partial class AddCustomDisplayPreferences
|
partial class AddCustomDisplayPreferences
|
||||||
{
|
{
|
||||||
|
|
|
@ -10,7 +10,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
|
||||||
namespace Jellyfin.Server.Implementations.Migrations
|
namespace Jellyfin.Server.Implementations.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(JellyfinDb))]
|
[DbContext(typeof(JellyfinDbContext))]
|
||||||
[Migration("20210320181425_AddIndexesAndCollations")]
|
[Migration("20210320181425_AddIndexesAndCollations")]
|
||||||
partial class AddIndexesAndCollations
|
partial class AddIndexesAndCollations
|
||||||
{
|
{
|
||||||
|
|
|
@ -9,7 +9,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
|
||||||
namespace Jellyfin.Server.Implementations.Migrations
|
namespace Jellyfin.Server.Implementations.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(JellyfinDb))]
|
[DbContext(typeof(JellyfinDbContext))]
|
||||||
[Migration("20210407110544_NullableCustomPrefValue")]
|
[Migration("20210407110544_NullableCustomPrefValue")]
|
||||||
partial class NullableCustomPrefValue
|
partial class NullableCustomPrefValue
|
||||||
{
|
{
|
||||||
|
|
|
@ -10,7 +10,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
|
||||||
namespace Jellyfin.Server.Implementations.Migrations
|
namespace Jellyfin.Server.Implementations.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(JellyfinDb))]
|
[DbContext(typeof(JellyfinDbContext))]
|
||||||
[Migration("20210814002109_AddDevices")]
|
[Migration("20210814002109_AddDevices")]
|
||||||
partial class AddDevices
|
partial class AddDevices
|
||||||
{
|
{
|
||||||
|
|
|
@ -12,7 +12,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
|
||||||
namespace Jellyfin.Server.Implementations.Migrations
|
namespace Jellyfin.Server.Implementations.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(JellyfinDb))]
|
[DbContext(typeof(JellyfinDbContext))]
|
||||||
[Migration("20221022080052_AddIndexActivityLogsDateCreated")]
|
[Migration("20221022080052_AddIndexActivityLogsDateCreated")]
|
||||||
partial class AddIndexActivityLogsDateCreated
|
partial class AddIndexActivityLogsDateCreated
|
||||||
{
|
{
|
||||||
|
|
|
@ -4,17 +4,17 @@ using Microsoft.EntityFrameworkCore.Design;
|
||||||
namespace Jellyfin.Server.Implementations.Migrations
|
namespace Jellyfin.Server.Implementations.Migrations
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The design time factory for <see cref="JellyfinDb"/>.
|
/// The design time factory for <see cref="JellyfinDbContext"/>.
|
||||||
/// This is only used for the creation of migrations and not during runtime.
|
/// This is only used for the creation of migrations and not during runtime.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal class DesignTimeJellyfinDbFactory : IDesignTimeDbContextFactory<JellyfinDb>
|
internal class DesignTimeJellyfinDbFactory : IDesignTimeDbContextFactory<JellyfinDbContext>
|
||||||
{
|
{
|
||||||
public JellyfinDb CreateDbContext(string[] args)
|
public JellyfinDbContext CreateDbContext(string[] args)
|
||||||
{
|
{
|
||||||
var optionsBuilder = new DbContextOptionsBuilder<JellyfinDb>();
|
var optionsBuilder = new DbContextOptionsBuilder<JellyfinDbContext>();
|
||||||
optionsBuilder.UseSqlite("Data Source=jellyfin.db");
|
optionsBuilder.UseSqlite("Data Source=jellyfin.db");
|
||||||
|
|
||||||
return new JellyfinDb(optionsBuilder.Options);
|
return new JellyfinDbContext(optionsBuilder.Options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
|
||||||
namespace Jellyfin.Server.Implementations.Migrations
|
namespace Jellyfin.Server.Implementations.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(JellyfinDb))]
|
[DbContext(typeof(JellyfinDbContext))]
|
||||||
partial class JellyfinDbModelSnapshot : ModelSnapshot
|
partial class JellyfinDbModelSnapshot : ModelSnapshot
|
||||||
{
|
{
|
||||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||||
|
|
|
@ -10,13 +10,13 @@ namespace Jellyfin.Server.Implementations.Security
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public class AuthenticationManager : IAuthenticationManager
|
public class AuthenticationManager : IAuthenticationManager
|
||||||
{
|
{
|
||||||
private readonly IDbContextFactory<JellyfinDb> _dbProvider;
|
private readonly IDbContextFactory<JellyfinDbContext> _dbProvider;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="AuthenticationManager"/> class.
|
/// Initializes a new instance of the <see cref="AuthenticationManager"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="dbProvider">The database provider.</param>
|
/// <param name="dbProvider">The database provider.</param>
|
||||||
public AuthenticationManager(IDbContextFactory<JellyfinDb> dbProvider)
|
public AuthenticationManager(IDbContextFactory<JellyfinDbContext> dbProvider)
|
||||||
{
|
{
|
||||||
_dbProvider = dbProvider;
|
_dbProvider = dbProvider;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,12 +16,12 @@ namespace Jellyfin.Server.Implementations.Security
|
||||||
{
|
{
|
||||||
public class AuthorizationContext : IAuthorizationContext
|
public class AuthorizationContext : IAuthorizationContext
|
||||||
{
|
{
|
||||||
private readonly IDbContextFactory<JellyfinDb> _jellyfinDbProvider;
|
private readonly IDbContextFactory<JellyfinDbContext> _jellyfinDbProvider;
|
||||||
private readonly IUserManager _userManager;
|
private readonly IUserManager _userManager;
|
||||||
private readonly IServerApplicationHost _serverApplicationHost;
|
private readonly IServerApplicationHost _serverApplicationHost;
|
||||||
|
|
||||||
public AuthorizationContext(
|
public AuthorizationContext(
|
||||||
IDbContextFactory<JellyfinDb> jellyfinDb,
|
IDbContextFactory<JellyfinDbContext> jellyfinDb,
|
||||||
IUserManager userManager,
|
IUserManager userManager,
|
||||||
IServerApplicationHost serverApplicationHost)
|
IServerApplicationHost serverApplicationHost)
|
||||||
{
|
{
|
||||||
|
|
|
@ -15,13 +15,13 @@ namespace Jellyfin.Server.Implementations.Users
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class DisplayPreferencesManager : IDisplayPreferencesManager
|
public class DisplayPreferencesManager : IDisplayPreferencesManager
|
||||||
{
|
{
|
||||||
private readonly JellyfinDb _dbContext;
|
private readonly JellyfinDbContext _dbContext;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="DisplayPreferencesManager"/> class.
|
/// Initializes a new instance of the <see cref="DisplayPreferencesManager"/> class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="dbContextFactory">The database context factory.</param>
|
/// <param name="dbContextFactory">The database context factory.</param>
|
||||||
public DisplayPreferencesManager(IDbContextFactory<JellyfinDb> dbContextFactory)
|
public DisplayPreferencesManager(IDbContextFactory<JellyfinDbContext> dbContextFactory)
|
||||||
{
|
{
|
||||||
_dbContext = dbContextFactory.CreateDbContext();
|
_dbContext = dbContextFactory.CreateDbContext();
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ namespace Jellyfin.Server.Implementations.Users
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class UserManager : IUserManager
|
public class UserManager : IUserManager
|
||||||
{
|
{
|
||||||
private readonly IDbContextFactory<JellyfinDb> _dbProvider;
|
private readonly IDbContextFactory<JellyfinDbContext> _dbProvider;
|
||||||
private readonly IEventManager _eventManager;
|
private readonly IEventManager _eventManager;
|
||||||
private readonly ICryptoProvider _cryptoProvider;
|
private readonly ICryptoProvider _cryptoProvider;
|
||||||
private readonly INetworkManager _networkManager;
|
private readonly INetworkManager _networkManager;
|
||||||
|
@ -59,7 +59,7 @@ namespace Jellyfin.Server.Implementations.Users
|
||||||
/// <param name="imageProcessor">The image processor.</param>
|
/// <param name="imageProcessor">The image processor.</param>
|
||||||
/// <param name="logger">The logger.</param>
|
/// <param name="logger">The logger.</param>
|
||||||
public UserManager(
|
public UserManager(
|
||||||
IDbContextFactory<JellyfinDb> dbProvider,
|
IDbContextFactory<JellyfinDbContext> dbProvider,
|
||||||
IEventManager eventManager,
|
IEventManager eventManager,
|
||||||
ICryptoProvider cryptoProvider,
|
ICryptoProvider cryptoProvider,
|
||||||
INetworkManager networkManager,
|
INetworkManager networkManager,
|
||||||
|
@ -172,7 +172,7 @@ namespace Jellyfin.Server.Implementations.Users
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal async Task<User> CreateUserInternalAsync(string name, JellyfinDb dbContext)
|
internal async Task<User> CreateUserInternalAsync(string name, JellyfinDbContext dbContext)
|
||||||
{
|
{
|
||||||
// TODO: Remove after user item data is migrated.
|
// TODO: Remove after user item data is migrated.
|
||||||
var max = await dbContext.Users.AsQueryable().AnyAsync().ConfigureAwait(false)
|
var max = await dbContext.Users.AsQueryable().AnyAsync().ConfigureAwait(false)
|
||||||
|
@ -886,7 +886,7 @@ namespace Jellyfin.Server.Implementations.Users
|
||||||
await UpdateUserAsync(user).ConfigureAwait(false);
|
await UpdateUserAsync(user).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task UpdateUserInternalAsync(JellyfinDb dbContext, User user)
|
private async Task UpdateUserInternalAsync(JellyfinDbContext dbContext, User user)
|
||||||
{
|
{
|
||||||
dbContext.Users.Update(user);
|
dbContext.Users.Update(user);
|
||||||
_users[user.Id] = user;
|
_users[user.Id] = user;
|
||||||
|
|
|
@ -107,7 +107,7 @@ namespace Jellyfin.Server
|
||||||
yield return typeof(CoreAppHost).Assembly;
|
yield return typeof(CoreAppHost).Assembly;
|
||||||
|
|
||||||
// Jellyfin.Server.Implementations
|
// Jellyfin.Server.Implementations
|
||||||
yield return typeof(JellyfinDb).Assembly;
|
yield return typeof(JellyfinDbContext).Assembly;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
|
|
@ -19,7 +19,7 @@ namespace Jellyfin.Server.Migrations.Routines
|
||||||
private const string DbFilename = "activitylog.db";
|
private const string DbFilename = "activitylog.db";
|
||||||
|
|
||||||
private readonly ILogger<MigrateActivityLogDb> _logger;
|
private readonly ILogger<MigrateActivityLogDb> _logger;
|
||||||
private readonly IDbContextFactory<JellyfinDb> _provider;
|
private readonly IDbContextFactory<JellyfinDbContext> _provider;
|
||||||
private readonly IServerApplicationPaths _paths;
|
private readonly IServerApplicationPaths _paths;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -28,7 +28,7 @@ namespace Jellyfin.Server.Migrations.Routines
|
||||||
/// <param name="logger">The logger.</param>
|
/// <param name="logger">The logger.</param>
|
||||||
/// <param name="paths">The server application paths.</param>
|
/// <param name="paths">The server application paths.</param>
|
||||||
/// <param name="provider">The database provider.</param>
|
/// <param name="provider">The database provider.</param>
|
||||||
public MigrateActivityLogDb(ILogger<MigrateActivityLogDb> logger, IServerApplicationPaths paths, IDbContextFactory<JellyfinDb> provider)
|
public MigrateActivityLogDb(ILogger<MigrateActivityLogDb> logger, IServerApplicationPaths paths, IDbContextFactory<JellyfinDbContext> provider)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_provider = provider;
|
_provider = provider;
|
||||||
|
|
|
@ -20,7 +20,7 @@ namespace Jellyfin.Server.Migrations.Routines
|
||||||
private const string DbFilename = "authentication.db";
|
private const string DbFilename = "authentication.db";
|
||||||
|
|
||||||
private readonly ILogger<MigrateAuthenticationDb> _logger;
|
private readonly ILogger<MigrateAuthenticationDb> _logger;
|
||||||
private readonly IDbContextFactory<JellyfinDb> _dbProvider;
|
private readonly IDbContextFactory<JellyfinDbContext> _dbProvider;
|
||||||
private readonly IServerApplicationPaths _appPaths;
|
private readonly IServerApplicationPaths _appPaths;
|
||||||
private readonly IUserManager _userManager;
|
private readonly IUserManager _userManager;
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ namespace Jellyfin.Server.Migrations.Routines
|
||||||
/// <param name="userManager">The user manager.</param>
|
/// <param name="userManager">The user manager.</param>
|
||||||
public MigrateAuthenticationDb(
|
public MigrateAuthenticationDb(
|
||||||
ILogger<MigrateAuthenticationDb> logger,
|
ILogger<MigrateAuthenticationDb> logger,
|
||||||
IDbContextFactory<JellyfinDb> dbProvider,
|
IDbContextFactory<JellyfinDbContext> dbProvider,
|
||||||
IServerApplicationPaths appPaths,
|
IServerApplicationPaths appPaths,
|
||||||
IUserManager userManager)
|
IUserManager userManager)
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,7 +25,7 @@ namespace Jellyfin.Server.Migrations.Routines
|
||||||
|
|
||||||
private readonly ILogger<MigrateDisplayPreferencesDb> _logger;
|
private readonly ILogger<MigrateDisplayPreferencesDb> _logger;
|
||||||
private readonly IServerApplicationPaths _paths;
|
private readonly IServerApplicationPaths _paths;
|
||||||
private readonly IDbContextFactory<JellyfinDb> _provider;
|
private readonly IDbContextFactory<JellyfinDbContext> _provider;
|
||||||
private readonly JsonSerializerOptions _jsonOptions;
|
private readonly JsonSerializerOptions _jsonOptions;
|
||||||
private readonly IUserManager _userManager;
|
private readonly IUserManager _userManager;
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ namespace Jellyfin.Server.Migrations.Routines
|
||||||
public MigrateDisplayPreferencesDb(
|
public MigrateDisplayPreferencesDb(
|
||||||
ILogger<MigrateDisplayPreferencesDb> logger,
|
ILogger<MigrateDisplayPreferencesDb> logger,
|
||||||
IServerApplicationPaths paths,
|
IServerApplicationPaths paths,
|
||||||
IDbContextFactory<JellyfinDb> provider,
|
IDbContextFactory<JellyfinDbContext> provider,
|
||||||
IUserManager userManager)
|
IUserManager userManager)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
|
|
|
@ -27,7 +27,7 @@ namespace Jellyfin.Server.Migrations.Routines
|
||||||
|
|
||||||
private readonly ILogger<MigrateUserDb> _logger;
|
private readonly ILogger<MigrateUserDb> _logger;
|
||||||
private readonly IServerApplicationPaths _paths;
|
private readonly IServerApplicationPaths _paths;
|
||||||
private readonly IDbContextFactory<JellyfinDb> _provider;
|
private readonly IDbContextFactory<JellyfinDbContext> _provider;
|
||||||
private readonly IXmlSerializer _xmlSerializer;
|
private readonly IXmlSerializer _xmlSerializer;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -40,7 +40,7 @@ namespace Jellyfin.Server.Migrations.Routines
|
||||||
public MigrateUserDb(
|
public MigrateUserDb(
|
||||||
ILogger<MigrateUserDb> logger,
|
ILogger<MigrateUserDb> logger,
|
||||||
IServerApplicationPaths paths,
|
IServerApplicationPaths paths,
|
||||||
IDbContextFactory<JellyfinDb> provider,
|
IDbContextFactory<JellyfinDbContext> provider,
|
||||||
IXmlSerializer xmlSerializer)
|
IXmlSerializer xmlSerializer)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
|
|
|
@ -236,7 +236,7 @@ namespace Jellyfin.Server
|
||||||
{
|
{
|
||||||
_logger.LogInformation("Running query planner optimizations in the database... This might take a while");
|
_logger.LogInformation("Running query planner optimizations in the database... This might take a while");
|
||||||
// Run before disposing the application
|
// Run before disposing the application
|
||||||
var context = await appHost.ServiceProvider.GetRequiredService<IDbContextFactory<JellyfinDb>>().CreateDbContextAsync().ConfigureAwait(false);
|
var context = await appHost.ServiceProvider.GetRequiredService<IDbContextFactory<JellyfinDbContext>>().CreateDbContextAsync().ConfigureAwait(false);
|
||||||
await using (context.ConfigureAwait(false))
|
await using (context.ConfigureAwait(false))
|
||||||
{
|
{
|
||||||
if (context.Database.IsSqlite())
|
if (context.Database.IsSqlite())
|
||||||
|
|
|
@ -119,7 +119,7 @@ namespace Jellyfin.Server
|
||||||
.ConfigurePrimaryHttpMessageHandler(defaultHttpClientHandlerDelegate);
|
.ConfigurePrimaryHttpMessageHandler(defaultHttpClientHandlerDelegate);
|
||||||
|
|
||||||
services.AddHealthChecks()
|
services.AddHealthChecks()
|
||||||
.AddCheck<DbContextFactoryHealthCheck<JellyfinDb>>(nameof(JellyfinDb));
|
.AddCheck<DbContextFactoryHealthCheck<JellyfinDbContext>>(nameof(JellyfinDbContext));
|
||||||
|
|
||||||
services.AddHlsPlaylistGenerator();
|
services.AddHlsPlaylistGenerator();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user