Jelajahi Sumber

Allow migration to optionally run on fresh install

crobibero 4 tahun lalu
induk
melakukan
9343e73b26

+ 5 - 0
Jellyfin.Server/Migrations/IMigrationRoutine.cs

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

+ 1 - 2
Jellyfin.Server/Migrations/MigrationRunner.cs

@@ -43,9 +43,8 @@ namespace Jellyfin.Server.Migrations
                 // If startup wizard is not finished, this is a fresh install.
                 // If startup wizard is not finished, this is a fresh install.
                 // Don't run any migrations, just mark all of them as applied.
                 // 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");
                 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);
                 host.ServerConfigurationManager.SaveConfiguration(MigrationsListStore.StoreKey, migrationOptions);
-                return;
             }
             }
 
 
             var appliedMigrationIds = migrationOptions.Applied.Select(m => m.Id).ToHashSet();
             var appliedMigrationIds = migrationOptions.Applied.Select(m => m.Id).ToHashSet();

+ 3 - 0
Jellyfin.Server/Migrations/Routines/AddDefaultPluginRepository.cs

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

+ 3 - 0
Jellyfin.Server/Migrations/Routines/CreateUserLoggingConfigFile.cs

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

+ 3 - 0
Jellyfin.Server/Migrations/Routines/DisableTranscodingThrottling.cs

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

+ 3 - 0
Jellyfin.Server/Migrations/Routines/MigrateActivityLogDb.cs

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

+ 3 - 0
Jellyfin.Server/Migrations/Routines/MigrateUserDb.cs

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

+ 3 - 0
Jellyfin.Server/Migrations/Routines/RemoveDuplicateExtras.cs

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