Jumoo / uSyncMigrations

Rough and ready migration code.
Mozilla Public License 2.0
46 stars 61 forks source link

Macro Migration Issue #111

Closed BPadfield closed 10 months ago

BPadfield commented 1 year ago

After running the migrations tool I get the error " XML Not valid for type Macro. " On further investigation it appears the xml structure exported from Umbraco 7 has the key attribute within the macro tag as an attribute and not as a separate element. The macros appear to have all been given a key of 00000000-0000-0000-0000-000000000000 and overwritten each other leaving a single file called 00000000-0000-0000-0000-000000000000.config in the uSync/Migrations/datetime/Macros folder. I've included some of the files from uSync v7 export which you should be able to use to replicate the problem. samples.zip

JamesDodwell commented 1 year ago

We've had this issue too. We're on Umbraco 7.3.4 and uSync.BackOffice [BackOffice: 3.0.4.0] [Core: 5.2.0.0].

BPadfield commented 1 year ago

We fixed it by adjusting the usync macro files using a ps script, I think it was this one although this may not be the final version we used:

$files = Get-ChildItem -Path . -Filter *.config
foreach($file in $files)
{
    $contents = [xml](Get-Content $file.FullName)
    $nodes = $contents.SelectNodes("//macro[@Key]")

    foreach($node in $nodes)
    {
        $keynode = $contents.CreateElement('Key')
        $keynode.InnerText = $node.GetAttribute('Key')
        $node.AppendChild($keynode)
    }
    $contents.Save($file.Fullname)
    Write-Host "Edited: $($file.Fullname)"
} 
KevinJump commented 10 months ago

Cleanup - Sorry i think we have fixed this in later releases, but we didn't track it to the issue :( - but it doesn't do this any more on a migration each macro gets the id value correctly assigned.