Merge pull request #3616 from crobibero/migration-new-install

Allow migration to optionally run on fresh install
This commit is contained in:
dkanada 2020-07-20 23:38:28 +09:00 committed by GitHub
commit 107cf21f26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 24 additions and 2 deletions

View File

@ -17,6 +17,11 @@ namespace Jellyfin.Server.Migrations
/// </summary>
public string Name { get; }
/// <summary>
/// Gets a value indicating whether to perform migration on a new install.
/// </summary>
public bool PerformOnNewInstall { get; }
/// <summary>
/// Execute the migration routine.
/// </summary>

View File

@ -43,9 +43,8 @@ namespace Jellyfin.Server.Migrations
// 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 a fresh install");
migrationOptions.Applied.AddRange(migrations.Select(m => (m.Id, m.Name)));
migrationOptions.Applied.AddRange(migrations.Where(m => !m.PerformOnNewInstall).Select(m => (m.Id, m.Name)));
host.ServerConfigurationManager.SaveConfiguration(MigrationsListStore.StoreKey, migrationOptions);
return;
}
var appliedMigrationIds = migrationOptions.Applied.Select(m => m.Id).ToHashSet();

View File

@ -32,6 +32,9 @@ namespace Jellyfin.Server.Migrations.Routines
/// <inheritdoc/>
public string Name => "AddDefaultPluginRepository";
/// <inheritdoc/>
public bool PerformOnNewInstall => true;
/// <inheritdoc/>
public void Perform()
{

View File

@ -48,6 +48,9 @@ namespace Jellyfin.Server.Migrations.Routines
/// <inheritdoc/>
public string Name => "CreateLoggingConfigHeirarchy";
/// <inheritdoc/>
public bool PerformOnNewInstall => false;
/// <inheritdoc/>
public void Perform()
{

View File

@ -25,6 +25,9 @@ namespace Jellyfin.Server.Migrations.Routines
/// <inheritdoc/>
public string Name => "DisableTranscodingThrottling";
/// <inheritdoc/>
public bool PerformOnNewInstall => false;
/// <inheritdoc/>
public void Perform()
{

View File

@ -41,6 +41,9 @@ namespace Jellyfin.Server.Migrations.Routines
/// <inheritdoc/>
public string Name => "MigrateActivityLogDatabase";
/// <inheritdoc/>
public bool PerformOnNewInstall => false;
/// <inheritdoc/>
public void Perform()
{

View File

@ -54,6 +54,9 @@ namespace Jellyfin.Server.Migrations.Routines
/// <inheritdoc/>
public string Name => "MigrateUserDatabase";
/// <inheritdoc/>
public bool PerformOnNewInstall => false;
/// <inheritdoc/>
public void Perform()
{

View File

@ -29,6 +29,9 @@ namespace Jellyfin.Server.Migrations.Routines
/// <inheritdoc/>
public string Name => "RemoveDuplicateExtras";
/// <inheritdoc/>
public bool PerformOnNewInstall => false;
/// <inheritdoc/>
public void Perform()
{