Upgrading from 13 to 17

Hi All,

I’m attempting to upgrade a site from 13 to 17, however I need a way to migrate Nested Content to a Block List and a Media Picker to Media Picker 3, Are there any pre-existing migration scripts out there that will do this. I can see something similar was done fro Umbraco Deploy - ReplaceNestedContentDataTypeArtifactMigrator and ReplaceMediaPickerDataTypeArtifactMigrator but we don’t have / use Deploy.

Thanks

Inspiration here:

Thanks for link :slight_smile:

We tried uSync Migrations on v13 and while it converts the data types from Nested Content to Block List, it doesn’t convert the content.

It should migrate the content too!

You’ll need to enable uSync for Content as uSync Migrations will only migrate what is converted to uSync files.

Hi, So that’s usync for Content package is it? And this will replace the content in situ?

Hello Paul!

A bit of shameless plug here. But I’ve also created a extension that’s also converts Nested content into block list!

1 Like

the autoblocklist package was great for my upgrade from 13 to 17, but I did have an issue with the legacy media picker, which is no longer available in v17, does Umbraco not migrate those as part of the update, after the upgrade, I had a message saying the content was still there and i needed to change the data type, which I did, but now I have lost the data. What do I need to do pre 17 upgrade to migrate the legacy media data types?

worked great for my upgrade, good work!

It’s no longer a separate package for content, but a setting..

Where is Content Edition? | Jumoo docs

Just need to include Content in the export on Save, if you want it to well export on save
appsettings.config | Jumoo docs

Or use the content option in the backoffice panels to export all the content… Assuming that the panel sets haven’t been hidden…

Turn Off Content Edition | Jumoo docs

Usync Migrations in place just picks up on everything that is in the uSync/v9 folder from your existing exporting.

On the Legacy Media Pickers.. I had to go with a custom migration plan/profile, think along these lines..

public class MediaPicker3kMigrationPlan : ISyncMigrationPlan
{
    private readonly SyncMigrationHandlerCollection _migrationHandlers;

    public MediaPicker3kMigrationPlan(SyncMigrationHandlerCollection migrationHandlers)
    {
        _migrationHandlers = migrationHandlers;
    }

    public int Order => 203;

    public string Name => "Convert Legacy Media to mediaPicker3";

    public string Icon => "icon-brick color-green";

    public string Description => "Convert Legacy Media to mediaPicker3";

    public MigrationOptions Options => new()
    {
        Group = "Convert",
        Source = "uSync/v9",
        Target = $"{uSyncMigrations.MigrationFolder}/mediapickers-to-mp3",
        Handlers = _migrationHandlers.SelectGroup(8, string.Empty),
        SourceVersion = 8,
        PreferredMigrators = new Dictionary<string, string>
        {
            //{ UmbConstants.PropertyEditors.Aliases.NestedContent, nameof(NestedToBlockListMigrator) },
            //{ UmbConstants.PropertyEditors.Aliases.Grid, nameof(GridToBlockGridMigrator) },
            { UmbConstants.PropertyEditors.Aliases.MediaPicker, nameof(SMMediaPickerMigrator) },
            { "Umbraco.MediaPicker2", nameof(SMMediaPickerMigrator) },
            { UmbConstants.PropertyEditors.Aliases.MultipleMediaPicker, nameof(SMMediaPickerMigrator)},
            { UmbConstants.PropertyEditors.Aliases.MultipleTextstring, nameof(SMMultipleTextStringMigrator)},
            //{ UmbConstants.PropertyEditors.Aliases.RadioButtonList, nameof(Lovell.Web.Extensions.Migrations.Migrators.SMRadioButtonListMigrator) }
        }
    };
}

and those custom migrators just slight tweaks on the MediaPickerMigrator… like

using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using Umbraco.Cms.Core.PropertyEditors.ValueConverters;
using uSync.Migrations.Core.Context;
using uSync.Migrations.Core.Migrators;
using uSync.Migrations.Core.Migrators.Models;
using uSync.Migrations.Migrators.Core;
using UmbConstants = Umbraco.Cms.Core.Constants;

namespace uSyncMigrationSite.Extensions.Migrators
{
    [SyncMigrator(UmbConstants.PropertyEditors.Aliases.MediaPicker)]
    [SyncMigrator("Umbraco.MediaPicker2")]
    [SyncMigrator(UmbConstants.PropertyEditors.Aliases.MultipleMediaPicker)]
    [SyncMigratorVersion(8)]
    public class SMMediaPickerMigrator : MediaPickerMigrator
    {
        public override string? GetContentValue(SyncMigrationContentProperty contentProperty, SyncMigrationContext context)
        {
            if (string.IsNullOrWhiteSpace(contentProperty.Value))
            {
                return contentProperty.Value;
            }

            //TODO: check it's not mediaPicker3Already... (seems to loop though twice for grid, and wipes out the ogImage)

            try
            {
                var mp3 = JsonConvert.DeserializeObject<IEnumerable<MediaWithCropsDto>>(contentProperty.Value);
                return contentProperty.Value;
            }
            catch
            {

                //if (contentProperty.Value.Contains("mediaKey"))
                //{
                //    return contentProperty.Value;
                //}

                //otherwsie try and convert
                var x = base.GetContentValue(contentProperty, context);
                return x;
            }
        }

        [JsonObject(NamingStrategyType = typeof(CamelCaseNamingStrategy))]
        private sealed class MediaWithCropsDto
        {
            public Guid Key { get; set; }

            public Guid MediaKey { get; set; }

            public IEnumerable<ImageCropperValue.ImageCropperCrop>? Crops { get; set; }

            public ImageCropperValue.ImageCropperFocalPoint? FocalPoint { get; set; }
        }

    }
}

Also an option with Umbraco Deploy, recently discussed…
Using Umbraco Deploy on Premise to Migrate from U13 → U17 - Umbraco community forum

1 Like

This didn’t work. It’s trying to bring in an old nuget backoffice package.

Umbraco Deploy can also be used to migrate certain things: Import and Export with Migrations | Deploy | Umbraco Documentation . Deploy is free on localhost, so maybe that’s worth something to look in to. I personally never got it to work.

I went with AutoBlockList that @Lantzify made. It works pretty well. The concept is that you create a converted property next to the original property so you can check is everything went well. I had to make a few changes to the code to fix some errors I got, but those were minor and I intend to merge those changes back into the original repo.

But I agree that this is annoying. So I’m currently building a ‘legacy feature converter’ package that’s extendible to be able to convert much more in the future. It’s very loosly based on AutoBlockList but I decided that I want to convert in-place instead of creating new properties. If you’re in real need, I could send you a beta version.

You need to do the migration with AutoBlockList before updating to Umbraco 17.

Awww that makes sense. Sorry. Been in it deep with a big 13 —> 17. Thanks.

@jason-delaplain So my workflow when upgrading has been to migrate the content in Umbraco 13 before upgrading to Umbraco 17 and running those migrations, since I have been unsure if it would lead to consequences if NestedContent & Macros were still present.

@Luuk That sounds really exicting! Please let me know when you’re done! :partying_face:

The editor for nested content does no longer exist in Umbraco 14+, but the underlying data still exists as-is. I think that technically, you could run the migration on Umbraco 17. However, I feel like you should make sure that you need to do as little as possible during the Umbraco 13 > 17 migration to minimize the risks. So I would ALWAYS advocate updating legacy editors first before the upgrade.

1 Like

Fyi a gotcha I had, was even though I’d migrated legacygrid to blockGrid when back in v13 (usync Migrations).. when updating to v17.. the helpful v17 migrator (for bring blockgrid data upto v17 schema) fell over as there was still Legacy grid data in past versions.. (only the current and published versions were blockGrid format)

Which are the suggestions and tips to upgrade from v13 its to 17 also with custom code, plugins and controllers?

This series applies to 17 as well.

2 Likes