Skip to content

Commit b6351f9

Browse files
authored
Make parallel block editor migration optional (#17827)
1 parent b0b4571 commit b6351f9

File tree

5 files changed

+23
-4
lines changed

5 files changed

+23
-4
lines changed

src/Umbraco.Infrastructure/Migrations/Upgrade/V_15_0_0/ConvertBlockEditorPropertiesBase.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ public abstract class ConvertBlockEditorPropertiesBase : MigrationBase
3232

3333
protected bool SkipMigration { get; init; }
3434

35+
protected bool ParallelizeMigration { get; init; }
36+
3537
protected enum EditorValueHandling
3638
{
3739
IgnoreConversion,
@@ -258,7 +260,7 @@ void HandleUpdateBatch(UpdateBatch<PropertyDataDto> update)
258260
propertyDataDto.TextValue = stringValue;
259261
}
260262

261-
if (DatabaseType == DatabaseType.SQLite)
263+
if (ParallelizeMigration is false || DatabaseType == DatabaseType.SQLite)
262264
{
263265
// SQLite locks up if we run the migration in parallel, so... let's not.
264266
foreach (UpdateBatch<PropertyDataDto> update in updateBatch)

src/Umbraco.Infrastructure/Migrations/Upgrade/V_15_0_0/ConvertBlockEditorPropertiesOptions.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,12 @@ public class ConvertBlockEditorPropertiesOptions
2626
/// If you choose to skip the migration, you're responsible for performing the content migration for Rich Texts after the V15 upgrade has completed.
2727
/// </remarks>
2828
public bool SkipRichTextEditors { get; set; } = false;
29+
30+
/// <summary>
31+
/// Setting this property to true will cause all block editor migrations to run as parallel operations.
32+
/// </summary>
33+
/// <remarks>
34+
/// While this greatly improves the speed of the migration, some content setups may experience issues and failing migrations as a result.
35+
/// </remarks>
36+
public bool ParallelizeMigration { get; set; } = false;
2937
}

src/Umbraco.Infrastructure/Migrations/Upgrade/V_15_0_0/ConvertBlockGridEditorProperties.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ public ConvertBlockGridEditorProperties(
2323
IOptions<ConvertBlockEditorPropertiesOptions> options,
2424
ICoreScopeProvider coreScopeProvider)
2525
: base(context, logger, contentTypeService, dataTypeService, jsonSerializer, umbracoContextFactory, languageService, coreScopeProvider)
26-
=> SkipMigration = options.Value.SkipBlockGridEditors;
26+
{
27+
SkipMigration = options.Value.SkipBlockGridEditors;
28+
ParallelizeMigration = options.Value.ParallelizeMigration;
29+
}
2730

2831
protected override IEnumerable<string> PropertyEditorAliases
2932
=> new[] { Constants.PropertyEditors.Aliases.BlockGrid };

src/Umbraco.Infrastructure/Migrations/Upgrade/V_15_0_0/ConvertBlockListEditorProperties.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ public ConvertBlockListEditorProperties(
2323
IOptions<ConvertBlockEditorPropertiesOptions> options,
2424
ICoreScopeProvider coreScopeProvider)
2525
: base(context, logger, contentTypeService, dataTypeService, jsonSerializer, umbracoContextFactory, languageService, coreScopeProvider)
26-
=> SkipMigration = options.Value.SkipBlockListEditors;
26+
{
27+
SkipMigration = options.Value.SkipBlockListEditors;
28+
ParallelizeMigration = options.Value.ParallelizeMigration;
29+
}
2730

2831
protected override IEnumerable<string> PropertyEditorAliases
2932
=> new[] { Constants.PropertyEditors.Aliases.BlockList };

src/Umbraco.Infrastructure/Migrations/Upgrade/V_15_0_0/ConvertRichTextEditorProperties.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ public ConvertRichTextEditorProperties(
2525
IOptions<ConvertBlockEditorPropertiesOptions> options,
2626
ICoreScopeProvider coreScopeProvider)
2727
: base(context, logger, contentTypeService, dataTypeService, jsonSerializer, umbracoContextFactory, languageService, coreScopeProvider)
28-
=> SkipMigration = options.Value.SkipRichTextEditors;
28+
{
29+
SkipMigration = options.Value.SkipRichTextEditors;
30+
ParallelizeMigration = options.Value.ParallelizeMigration;
31+
}
2932

3033
protected override IEnumerable<string> PropertyEditorAliases
3134
=> new[] { Constants.PropertyEditors.Aliases.TinyMce, Constants.PropertyEditors.Aliases.RichText };

0 commit comments

Comments
 (0)