diff options
| author | JPVenson <github@jpb.email> | 2025-07-15 03:36:36 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-14 18:36:36 -0600 |
| commit | c51f3a3342572ee1df585ed8c16f4bc6c1aab7dc (patch) | |
| tree | 2c3cfe3fceeba13522e7435b07ede649e1272a83 /Jellyfin.Server | |
| parent | 7ece959f4ef0847e43242c7f2c6bc502c4df429d (diff) | |
Use IDatabaseCreator instead of relying on History repository (#14465)
Diffstat (limited to 'Jellyfin.Server')
| -rw-r--r-- | Jellyfin.Server/Migrations/JellyfinMigrationService.cs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Jellyfin.Server/Migrations/JellyfinMigrationService.cs b/Jellyfin.Server/Migrations/JellyfinMigrationService.cs index 31a220118..fe191916c 100644 --- a/Jellyfin.Server/Migrations/JellyfinMigrationService.cs +++ b/Jellyfin.Server/Migrations/JellyfinMigrationService.cs @@ -17,6 +17,7 @@ using MediaBrowser.Model.Configuration; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage; using Microsoft.Extensions.Logging; namespace Jellyfin.Server.Migrations; @@ -105,6 +106,13 @@ internal class JellyfinMigrationService var dbContext = await _dbContextFactory.CreateDbContextAsync().ConfigureAwait(false); await using (dbContext.ConfigureAwait(false)) { + var databaseCreator = dbContext.Database.GetService<IDatabaseCreator>() as IRelationalDatabaseCreator + ?? throw new InvalidOperationException("Jellyfin does only support relational databases."); + if (!await databaseCreator.ExistsAsync().ConfigureAwait(false)) + { + await databaseCreator.CreateAsync().ConfigureAwait(false); + } + var historyRepository = dbContext.GetService<IHistoryRepository>(); await historyRepository.CreateIfNotExistsAsync().ConfigureAwait(false); |
