From b6351f9f336ae70da5a5ec143ff0db7f280c48b6 Mon Sep 17 00:00:00 2001 From: Kenn Jacobsen Date: Wed, 18 Dec 2024 13:41:07 +0100 Subject: [PATCH] Make parallel block editor migration optional (#17827) --- .../Upgrade/V_15_0_0/ConvertBlockEditorPropertiesBase.cs | 4 +++- .../V_15_0_0/ConvertBlockEditorPropertiesOptions.cs | 8 ++++++++ .../Upgrade/V_15_0_0/ConvertBlockGridEditorProperties.cs | 5 ++++- .../Upgrade/V_15_0_0/ConvertBlockListEditorProperties.cs | 5 ++++- .../Upgrade/V_15_0_0/ConvertRichTextEditorProperties.cs | 5 ++++- 5 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/Umbraco.Infrastructure/Migrations/Upgrade/V_15_0_0/ConvertBlockEditorPropertiesBase.cs b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_15_0_0/ConvertBlockEditorPropertiesBase.cs index bd8d702efa..1c60fc123c 100644 --- a/src/Umbraco.Infrastructure/Migrations/Upgrade/V_15_0_0/ConvertBlockEditorPropertiesBase.cs +++ b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_15_0_0/ConvertBlockEditorPropertiesBase.cs @@ -32,6 +32,8 @@ public abstract class ConvertBlockEditorPropertiesBase : MigrationBase protected bool SkipMigration { get; init; } + protected bool ParallelizeMigration { get; init; } + protected enum EditorValueHandling { IgnoreConversion, @@ -258,7 +260,7 @@ public abstract class ConvertBlockEditorPropertiesBase : MigrationBase propertyDataDto.TextValue = stringValue; } - if (DatabaseType == DatabaseType.SQLite) + if (ParallelizeMigration is false || DatabaseType == DatabaseType.SQLite) { // SQLite locks up if we run the migration in parallel, so... let's not. foreach (UpdateBatch update in updateBatch) diff --git a/src/Umbraco.Infrastructure/Migrations/Upgrade/V_15_0_0/ConvertBlockEditorPropertiesOptions.cs b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_15_0_0/ConvertBlockEditorPropertiesOptions.cs index 348b8e8e21..dff8d35017 100644 --- a/src/Umbraco.Infrastructure/Migrations/Upgrade/V_15_0_0/ConvertBlockEditorPropertiesOptions.cs +++ b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_15_0_0/ConvertBlockEditorPropertiesOptions.cs @@ -26,4 +26,12 @@ public class ConvertBlockEditorPropertiesOptions /// If you choose to skip the migration, you're responsible for performing the content migration for Rich Texts after the V15 upgrade has completed. /// public bool SkipRichTextEditors { get; set; } = false; + + /// + /// Setting this property to true will cause all block editor migrations to run as parallel operations. + /// + /// + /// While this greatly improves the speed of the migration, some content setups may experience issues and failing migrations as a result. + /// + public bool ParallelizeMigration { get; set; } = false; } diff --git a/src/Umbraco.Infrastructure/Migrations/Upgrade/V_15_0_0/ConvertBlockGridEditorProperties.cs b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_15_0_0/ConvertBlockGridEditorProperties.cs index 64fc64a961..4c4c8e1e4e 100644 --- a/src/Umbraco.Infrastructure/Migrations/Upgrade/V_15_0_0/ConvertBlockGridEditorProperties.cs +++ b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_15_0_0/ConvertBlockGridEditorProperties.cs @@ -23,7 +23,10 @@ public class ConvertBlockGridEditorProperties : ConvertBlockEditorPropertiesBase IOptions options, ICoreScopeProvider coreScopeProvider) : base(context, logger, contentTypeService, dataTypeService, jsonSerializer, umbracoContextFactory, languageService, coreScopeProvider) - => SkipMigration = options.Value.SkipBlockGridEditors; + { + SkipMigration = options.Value.SkipBlockGridEditors; + ParallelizeMigration = options.Value.ParallelizeMigration; + } protected override IEnumerable PropertyEditorAliases => new[] { Constants.PropertyEditors.Aliases.BlockGrid }; diff --git a/src/Umbraco.Infrastructure/Migrations/Upgrade/V_15_0_0/ConvertBlockListEditorProperties.cs b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_15_0_0/ConvertBlockListEditorProperties.cs index 5ea86f07f3..918fd9ebbc 100644 --- a/src/Umbraco.Infrastructure/Migrations/Upgrade/V_15_0_0/ConvertBlockListEditorProperties.cs +++ b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_15_0_0/ConvertBlockListEditorProperties.cs @@ -23,7 +23,10 @@ public class ConvertBlockListEditorProperties : ConvertBlockEditorPropertiesBase IOptions options, ICoreScopeProvider coreScopeProvider) : base(context, logger, contentTypeService, dataTypeService, jsonSerializer, umbracoContextFactory, languageService, coreScopeProvider) - => SkipMigration = options.Value.SkipBlockListEditors; + { + SkipMigration = options.Value.SkipBlockListEditors; + ParallelizeMigration = options.Value.ParallelizeMigration; + } protected override IEnumerable PropertyEditorAliases => new[] { Constants.PropertyEditors.Aliases.BlockList }; diff --git a/src/Umbraco.Infrastructure/Migrations/Upgrade/V_15_0_0/ConvertRichTextEditorProperties.cs b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_15_0_0/ConvertRichTextEditorProperties.cs index 60c1438059..3df45e4e8c 100644 --- a/src/Umbraco.Infrastructure/Migrations/Upgrade/V_15_0_0/ConvertRichTextEditorProperties.cs +++ b/src/Umbraco.Infrastructure/Migrations/Upgrade/V_15_0_0/ConvertRichTextEditorProperties.cs @@ -25,7 +25,10 @@ public partial class ConvertRichTextEditorProperties : ConvertBlockEditorPropert IOptions options, ICoreScopeProvider coreScopeProvider) : base(context, logger, contentTypeService, dataTypeService, jsonSerializer, umbracoContextFactory, languageService, coreScopeProvider) - => SkipMigration = options.Value.SkipRichTextEditors; + { + SkipMigration = options.Value.SkipRichTextEditors; + ParallelizeMigration = options.Value.ParallelizeMigration; + } protected override IEnumerable PropertyEditorAliases => new[] { Constants.PropertyEditors.Aliases.TinyMce, Constants.PropertyEditors.Aliases.RichText };