uSyncMigrations: Change nested content doctype con...
# help-with-umbraco
p
Wondering if anyone can offer some advice/insight into my approach at addressing [this issue](https://github.com/Jumoo/uSyncMigrations/discussions/172) I've created a new Migrator that inherits from
SyncPropertyMigratorBase
and when I run the conversion no content is converted. My Migration plan is defined as follows:
Copy code
public class SlideShowSlideMigrationPlan : ISyncMigrationPlan
{
    private readonly SyncMigrationHandlerCollection _migrationHandlers;

    public SlideShowSlideMigrationPlan(SyncMigrationHandlerCollection migrationHandlers)
    {
        _migrationHandlers = migrationHandlers;
    }
    
    public int Order => 100;
    public string Name => "Convert NestedContent SlideShowSlide to SlideshowContentBlockSlide";
    public string Icon => "icon-brick color-green";
    public string Description => "Converts any slides within NestedContent property editors to SlideshowContentBlockSlide.";
    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>
        {
            { Constants.PropertyEditors.Aliases.NestedContent, nameof(NestedContentSlideShowSlideMigrator) },
        }
    };
}
I have a breakpoint set in the actual migratior which is never hit and so I suspect that the migrator is never executed due to the existence of the NestedContentMigrator that is already a part of the uSyncMigrations package. Any ideas how I can have this execute in addition (preferably after) the other one?
k
Hi Just checking you have a Content folder in your
uSync/v9
folder (or whatever your source folder is) ? Assuming you do, then looking at it it should hit your migrator - that is how the nested to block list plan works in the core - https://github.com/Jumoo/uSyncMigrations/blob/main/uSync.Migrations/Configuration/CoreProfiles/BlockListMigrationPlan.cs yours looks almost identical so should work. does your migrator have a
[SyncMigrationVersion]
attribute for v8 (this is short hand for settings the
Versions
array, but its easy to overlook, and if you don't explicity say the hanfler is for v8 it won't be loaded by the process https://github.com/Jumoo/uSyncMigrations/blob/main/uSync.Migrations/Migrators/Optional/NestedToBlockListMigrator.cs#L23
p
> Just checking you have a Content folder in your uSync/v9 folder (or whatever your source folder is) ? Hi @Kevin Jump Interestingly, no it doesn't. I wonder why 🤔 > does your migrator have a [SyncMigrationVersion] attribute for v8 Yes, it does. I actually used your existing
NestedContentMigrator
as the basis for mine.
k
maybe you have content 'edtition' turned off in the config ? (or not installed if you are coming from v8)
p
I'm actually coming from v7 here. My migration folder has Content in
uSync\migrate\migration_data_2023_08_09_165336\migrated
perhaps I need to execute the import again?
I've just come back from 3 weeks away. I've ran this so many times I've lost track, I wonder if I perhaps removed it before I left or was midway through a trial run. It's a big site and takes a very long time to complete so will kick off another import and see if that puts the content folder in there?
k
yeah i do that when testing too. and then forget.. and spend hours wondering where its all gone,
p
If I can find the time to look into it, it would be a great help from a timesaving perspective to just be able to execute the content or media imports (or any selectively) without doing all. The media library on this site is mahusive and one of the biggest contributors to the time it takes to run.
It may of course not be possible though due to dependencies which is why it is already grouped together.
k
yeah in theory its possible - at the moment we are leaning on some core uSync UI which groups them, as you say mainly for dependencies and the majorty of people not getting tripped up. But i have thought about splitting it for this, its as you say just getting some time to do it.
p
I'd love to contribute more to this, especially since I started out building something with a similar concept but it was far inferior and less features. It's a valuable tool. Unfortunately, its unlikely that time can be made available until after I have completed this migration but I do have others in the pipeline which will benefit from it.
For my migration plan, since I have specified a preferred migrator will it only execute that one, or just that one first?
k
For NestedContent it will execute only that one - it replaces the default one for NestedContent
p
OK good, so I can run a normal import first that will execute yours then do mine as a separate plan which is useful. Thanks
The media has now completed and now waiting on content but should that not have placed a Media directory in
uSync/v9
?
k
no, the migrations go into a diffrent folder (its in migrate i think), the imports are then ran from these folders, so your uSync/v9 folder isn't actually changed by the migration.
p
Oh, so in that case there is a Content and Media directory.
There is definitely content in the migrate folder but still nothing being reported to import under Content when I try and run my migration plan
The breakpoint on my migrator is still not being hit
It does report 16 datatype updates and 2 doctypes being updated as part of the plan, just no content
I've updated the issue on Github to include both the migration plan and migrator in case you can see anything obvious that I am missing. https://github.com/Jumoo/uSyncMigrations/discussions/172
@Kevin Jump Am I correct that the migrators should be able to handle nested, nested content properties?
k
hi, yeah - its all recursive, so a nested migrator will go over the properties inside the nested content item, and hands them over to the relevant migrator, so if the nested content item has a nested content property in it, then that gets processed by the nested content migrator
p
Thanks for confirming. I'm completely stumped then at the moment as to why my migrator is not getting hit. It's probably something really obvious.