Created
April 29, 2024 09:20
-
-
Save KevinJump/ce72343e92b8f8b2566a70c5c6e340d8 to your computer and use it in GitHub Desktop.
uSync Migrator and plan to make nested content go through the conversion process in v8 (which it doesn't by default).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using uSync.Migrations.Core; | |
using uSync.Migrations.Core.Handlers; | |
using uSync.Migrations.Core.Legacy; | |
using uSync.Migrations.Core.Migrators; | |
using uSync.Migrations.Core.Plans; | |
using uSync.Migrations.Core.Plans.Models; | |
using uSync.Migrations.Migrators.Core; | |
namespace MyMigrations; | |
/// <summary> | |
/// migrator to mark nested content as something we should convert for v8. | |
/// </summary> | |
[SyncMigrator(uSyncMigrations.EditorAliases.NestedContent, typeof(LegacyNestedContentConfiguration), IsDefaultAlias = true)] | |
[SyncMigrator(uSyncMigrations.EditorAliases.NestedContentCommunity)] | |
[SyncMigratorVersion(8)] | |
public class NestedContentMigratorV8 : NestedContentMigrator | |
{ } | |
/// <summary> | |
/// migration plan, sets up v8 nested content as something we should migrate. | |
/// </summary> | |
internal class NestedV8Plan : ISyncMigrationPlan | |
{ | |
private readonly SyncMigrationHandlerCollection _migrationHandlers; | |
public NestedV8Plan(SyncMigrationHandlerCollection migrationHandlers) | |
{ | |
_migrationHandlers = migrationHandlers; | |
} | |
public int Order => 11; | |
public string Icon => "icon-cloud color-red"; | |
public string Name => "Migrated legacy Nested Content -> Nested Content"; | |
public string Description => "Nested content from v8 through the converter"; | |
public MigrationOptions Options => new MigrationOptions | |
{ | |
Group = "Convert", | |
Source = "uSync/v9", | |
Target = $"{uSyncMigrations.MigrationFolder}/{DateTime.Now:yyyyMMdd_HHmmss}", | |
Handlers = _migrationHandlers.SelectGroup(8, string.Empty), | |
SourceVersion = 8, | |
PreferredMigrators = new Dictionary<string, string> | |
{ | |
{ uSyncMigrations.EditorAliases.NestedContent, "NestedContentMigratorV8" }, | |
{ uSyncMigrations.EditorAliases.NestedContentCommunity, "NestedContentMigratorV8" }, | |
} | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment