diff options
| author | Niels van Velzen <nielsvanvelzen@users.noreply.github.com> | 2025-06-10 17:34:16 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-10 17:34:16 +0200 |
| commit | c8a51160b4018fbb9efbc9413793383166c655de (patch) | |
| tree | b2632412661a6f7df5b4a73c2362837226fc5e23 | |
| parent | 6b5ce934b3ad522cc73b702538026ec7c99103cd (diff) | |
| parent | 4a0a45a0459a9921cee88456f2f5bac0dc294f1f (diff) | |
Merge pull request #14269 from JPVenson/bugfix/BackupTableNames
Fix schema name on backup
| -rw-r--r-- | Jellyfin.Server.Implementations/FullSystemBackup/BackupService.cs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Jellyfin.Server.Implementations/FullSystemBackup/BackupService.cs b/Jellyfin.Server.Implementations/FullSystemBackup/BackupService.cs index e266d5a3b..d439fcb18 100644 --- a/Jellyfin.Server.Implementations/FullSystemBackup/BackupService.cs +++ b/Jellyfin.Server.Implementations/FullSystemBackup/BackupService.cs @@ -292,12 +292,12 @@ public class BackupService : IBackupService var historyRepository = dbContext.GetService<IHistoryRepository>(); var migrations = await historyRepository.GetAppliedMigrationsAsync().ConfigureAwait(false); - ICollection<(Type Type, Func<IAsyncEnumerable<object>> ValueFactory)> entityTypes = [ + ICollection<(Type Type, string SourceName, Func<IAsyncEnumerable<object>> ValueFactory)> entityTypes = [ .. typeof(JellyfinDbContext) .GetProperties(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance) .Where(e => e.PropertyType.IsAssignableTo(typeof(IQueryable))) - .Select(e => (Type: e.PropertyType, ValueFactory: new Func<IAsyncEnumerable<object>>(() => GetValues((IQueryable)e.GetValue(dbContext)!, e.PropertyType)))), - (Type: typeof(HistoryRow), ValueFactory: new Func<IAsyncEnumerable<object>>(() => migrations.ToAsyncEnumerable())) + .Select(e => (Type: e.PropertyType, dbContext.Model.FindEntityType(e.PropertyType.GetGenericArguments()[0])!.GetSchemaQualifiedTableName()!, ValueFactory: new Func<IAsyncEnumerable<object>>(() => GetValues((IQueryable)e.GetValue(dbContext)!, e.PropertyType)))), + (Type: typeof(HistoryRow), SourceName: nameof(HistoryRow), ValueFactory: new Func<IAsyncEnumerable<object>>(() => migrations.ToAsyncEnumerable())) ]; manifest.DatabaseTables = entityTypes.Select(e => e.Type.Name).ToArray(); var transaction = await dbContext.Database.BeginTransactionAsync().ConfigureAwait(false); @@ -308,8 +308,8 @@ public class BackupService : IBackupService foreach (var entityType in entityTypes) { - _logger.LogInformation("Begin backup of entity {Table}", entityType.Type.Name); - var zipEntry = zipArchive.CreateEntry($"Database\\{entityType.Type.Name}.json"); + _logger.LogInformation("Begin backup of entity {Table}", entityType.SourceName); + var zipEntry = zipArchive.CreateEntry($"Database\\{entityType.SourceName}.json"); var entities = 0; var zipEntryStream = zipEntry.Open(); await using (zipEntryStream.ConfigureAwait(false)) |
