I am going through the process for a client to upgrade from 7.15.2 to the latest v8 currently 8.18.3.
Using the Umbraco migrations and the Proworks amazing migration package most things are working well. One strange thing that isn't working is the migration of Related Links to MultiUrlPicker. when inside nested content.
It should be noted that any Related Links successfully convert to MultiUrlPicker when not used inside of Nested Content.
When used inside a Nested Content item the migration to MultiUrlPicker is done at data type level but the property data is not updated.
I am sure there is a better way to do this, my client only had a few links to fix so I got away with a dirty bit of SQL but a better SQL could be written to find all of the MultiUrlPickers who's value is not updated from RelatedLinks. I.e. has a caption field etc.
I created a migration so it's only ran once.
var sql = Sql($"SELECT upd.* FROM dbo.umbracoPropertyData AS upd INNER JOIN dbo.umbracoContentVersion AS ucv ON ucv.id = upd.versionId WHERE upd.textValue LIKE '%\"caption\":%' AND upd.textValue LIKE '%\"isInternal\":%' AND ucv.[current] = 1");
var dataToConvert = Database.Fetch<PropertyDataDto>(sql);
if (dataToConvert.Any())
{
Logger.Info<NestedContentRelatedLinkMigration>("Found " + dataToConvert.Count + " RelatedLinks to fix");
foreach (var propertyDataDto in dataToConvert)
{
var items = JArray.Parse(propertyDataDto.TextValue);
if (items.Any())
{
foreach (var item in items)
{
if (item is JObject arrayProperty)
{
var aliasFound = LinkAliases.Where(x => arrayProperty.ContainsKey(x)).ToList();
if (aliasFound.Any())
{
foreach (var alias in aliasFound)
{
var i = arrayProperty[alias];
var t = JsonConvert.DeserializeObject<List<RelatedLinkDto>>(i.ToString());
var toLink = (from x in t
select new LinkDto()
{
Name = x.Caption,
Target = x.NewWindow ? "_blank" : null,
Udi = x.Link.Contains("umb://") ? x.Link : null,
Url = x.IsInternal == false ? x.Link : null
}).ToList();
arrayProperty[alias] = JToken.Parse(JsonConvert.SerializeObject(toLink));
}
}
}
}
propertyDataDto.TextValue = items.ToString();
Database.Update(propertyDataDto);
}
}
}
7.15.2 to v8 latest migration
Hi all,
I am going through the process for a client to upgrade from 7.15.2 to the latest v8 currently 8.18.3.
Using the Umbraco migrations and the Proworks amazing migration package most things are working well. One strange thing that isn't working is the migration of
Related Links
toMultiUrlPicker
. when inside nested content.It should be noted that any
Related Links
successfully convert toMultiUrlPicker
when not used inside ofNested Content
.When used inside a
Nested Content
item the migration toMultiUrlPicker
is done at data type level but the property data is not updated.Anyone have any ideas? Or solutions?
Thanks muchly.
J
I am sure there is a better way to do this, my client only had a few links to fix so I got away with a dirty bit of SQL but a better SQL could be written to find all of the MultiUrlPickers who's value is not updated from RelatedLinks. I.e. has a caption field etc.
I created a migration so it's only ran once.
is working on a reply...