Make parallel block editor migration optional (#17827)

This commit is contained in:
Kenn Jacobsen
2024-12-18 13:41:07 +01:00
committed by GitHub
parent b0b4571686
commit b6351f9f33
5 changed files with 23 additions and 4 deletions

View File

@@ -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<PropertyDataDto> update in updateBatch)

View File

@@ -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.
/// </remarks>
public bool SkipRichTextEditors { get; set; } = false;
/// <summary>
/// Setting this property to true will cause all block editor migrations to run as parallel operations.
/// </summary>
/// <remarks>
/// While this greatly improves the speed of the migration, some content setups may experience issues and failing migrations as a result.
/// </remarks>
public bool ParallelizeMigration { get; set; } = false;
}

View File

@@ -23,7 +23,10 @@ public class ConvertBlockGridEditorProperties : ConvertBlockEditorPropertiesBase
IOptions<ConvertBlockEditorPropertiesOptions> 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<string> PropertyEditorAliases
=> new[] { Constants.PropertyEditors.Aliases.BlockGrid };

View File

@@ -23,7 +23,10 @@ public class ConvertBlockListEditorProperties : ConvertBlockEditorPropertiesBase
IOptions<ConvertBlockEditorPropertiesOptions> 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<string> PropertyEditorAliases
=> new[] { Constants.PropertyEditors.Aliases.BlockList };

View File

@@ -25,7 +25,10 @@ public partial class ConvertRichTextEditorProperties : ConvertBlockEditorPropert
IOptions<ConvertBlockEditorPropertiesOptions> 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<string> PropertyEditorAliases
=> new[] { Constants.PropertyEditors.Aliases.TinyMce, Constants.PropertyEditors.Aliases.RichText };