Unified migration handling (#13950)

This commit is contained in:
JPVenson
2025-04-28 03:18:08 +03:00
committed by GitHub
parent 1c4b5199b8
commit e66c76fc34
40 changed files with 555 additions and 528 deletions

View File

@@ -580,21 +580,6 @@ namespace Emby.Server.Implementations
/// <returns>A task representing the service initialization operation.</returns>
public async Task InitializeServices(IConfiguration startupConfig)
{
var factory = Resolve<IDbContextFactory<JellyfinDbContext>>();
var provider = Resolve<IJellyfinDatabaseProvider>();
provider.DbContextFactory = factory;
var jellyfinDb = await factory.CreateDbContextAsync().ConfigureAwait(false);
await using (jellyfinDb.ConfigureAwait(false))
{
if ((await jellyfinDb.Database.GetPendingMigrationsAsync().ConfigureAwait(false)).Any())
{
Logger.LogInformation("There are pending EFCore migrations in the database. Applying... (This may take a while, do not stop Jellyfin)");
await jellyfinDb.Database.MigrateAsync().ConfigureAwait(false);
Logger.LogInformation("EFCore migrations applied successfully");
}
}
var localizationManager = (LocalizationManager)Resolve<ILocalizationManager>();
await localizationManager.LoadAll().ConfigureAwait(false);