diff options
| author | Vasily <just.one.man@yandex.ru> | 2020-03-06 13:22:44 +0300 |
|---|---|---|
| committer | Vasily <just.one.man@yandex.ru> | 2020-03-06 13:22:44 +0300 |
| commit | d4564d8e29274a854bdc46df3ebcaf0c1e39e906 (patch) | |
| tree | 1c081f858e8041a1c1a84ff51229f4691add7e27 /Jellyfin.Server | |
| parent | 216e425cc55e8de1718df76f89c923cdf54de871 (diff) | |
More logging, mark all migrations as applied if setup wizard is not complete
Diffstat (limited to 'Jellyfin.Server')
| -rw-r--r-- | Jellyfin.Server/Migrations/MigrationRunner.cs | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/Jellyfin.Server/Migrations/MigrationRunner.cs b/Jellyfin.Server/Migrations/MigrationRunner.cs index 8b72cb467..00a7c3a00 100644 --- a/Jellyfin.Server/Migrations/MigrationRunner.cs +++ b/Jellyfin.Server/Migrations/MigrationRunner.cs @@ -28,6 +28,17 @@ namespace Jellyfin.Server.Migrations { var logger = loggerFactory.CreateLogger<MigrationRunner>(); var migrationOptions = ((IConfigurationManager)host.ServerConfigurationManager).GetConfiguration<MigrationOptions>(MigrationsListStore.StoreKey); + + if (!host.ServerConfigurationManager.Configuration.IsStartupWizardCompleted) + { + // If startup wizard is not finished, this is a fresh install. + // Don't run any migrations, just mark all of them as applied. + logger.LogInformation("Marking all known migrations as applied because this is fresh install"); + migrationOptions.Applied = Migrations.Select(m => m.Name).ToArray(); + host.ServerConfigurationManager.SaveConfiguration(MigrationsListStore.StoreKey, migrationOptions); + return; + } + var applied = migrationOptions.Applied.ToList(); for (var i = 0; i < Migrations.Length; i++) @@ -35,20 +46,22 @@ namespace Jellyfin.Server.Migrations var updater = Migrations[i]; if (applied.Contains(updater.Name)) { - logger.LogDebug("Skipping migration {0} as it is already applied", updater.Name); + logger.LogDebug("Skipping migration {Name} as it is already applied", updater.Name); continue; } + logger.LogInformation("Applying migration {Name}", updater.Name); try { updater.Perform(host, logger); } catch (Exception ex) { - logger.LogError(ex, "Cannot apply migration {0}", updater.Name); + logger.LogError(ex, "Cannot apply migration {Name}", updater.Name); continue; } + logger.LogInformation("Migration {Name} applied successfully", updater.Name); applied.Add(updater.Name); } |
