aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Server
diff options
context:
space:
mode:
authorMark Monteiro <marknr.monteiro@protonmail.com>2020-03-08 15:02:42 +0100
committerMark Monteiro <marknr.monteiro@protonmail.com>2020-03-08 15:02:42 +0100
commita0fdceb4bcf672bb87bed9f89921f60e8213080b (patch)
tree5c8edf4804b1f4b3956524d9e0e607ac993664ce /Jellyfin.Server
parentae9948ce044efda3f6e674383a743f7e30428e37 (diff)
Throw exception on migration failure to halt application
Also save migration configuration after each migration instead of at the end in case an exception is thrown part way through the list
Diffstat (limited to 'Jellyfin.Server')
-rw-r--r--Jellyfin.Server/Migrations/MigrationRunner.cs8
1 files changed, 2 insertions, 6 deletions
diff --git a/Jellyfin.Server/Migrations/MigrationRunner.cs b/Jellyfin.Server/Migrations/MigrationRunner.cs
index 8bc29d8ac..0f9c2a391 100644
--- a/Jellyfin.Server/Migrations/MigrationRunner.cs
+++ b/Jellyfin.Server/Migrations/MigrationRunner.cs
@@ -59,16 +59,12 @@ namespace Jellyfin.Server.Migrations
catch (Exception ex)
{
logger.LogError(ex, "Could not apply migration {Name}", migrationRoutine.Name);
- continue;
+ throw;
}
+ // Mark the migration as completed
logger.LogInformation("Migration {Name} applied successfully", migrationRoutine.Name);
applied.Add(migrationRoutine.Name);
- }
-
- if (applied.Count > migrationOptions.Applied.Length)
- {
- logger.LogInformation("Some migrations were run, saving the state");
migrationOptions.Applied = applied.ToArray();
host.ServerConfigurationManager.SaveConfiguration(MigrationsListStore.StoreKey, migrationOptions);
}