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