Dragonfly.Migration7To8Helpers 0.5.0

dotnet add package Dragonfly.Migration7To8Helpers --version 0.5.0                
NuGet\Install-Package Dragonfly.Migration7To8Helpers -Version 0.5.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Dragonfly.Migration7To8Helpers" Version="0.5.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Dragonfly.Migration7To8Helpers --version 0.5.0                
#r "nuget: Dragonfly.Migration7To8Helpers, 0.5.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Dragonfly.Migration7To8Helpers as a Cake Addin
#addin nuget:?package=Dragonfly.Migration7To8Helpers&version=0.5.0

// Install Dragonfly.Migration7To8Helpers as a Cake Tool
#tool nuget:?package=Dragonfly.Migration7To8Helpers&version=0.5.0                

Dragonfly.Migration7To8Helpers

Data cleaning/conversion tools for Umbraco 7 to Umbraco 8 migrations created by Heather Floyd.

Installation

Via NuGet: Nuget Downloads

 PM>   Install-Package Dragonfly.Migration7To8Helpers

Description

To be installed into a v8 site right after database upgrade to v8, when data needs to be fixed for compatibility.

DISCLAIMER: This tool gives you a lot of power to alter your property data directly. Be responsible. Make database backups in case something goes horribly wrong. Use the "Preview Only" option to check the results before actually updating the data, etc.

If you screw up your website, it is your own fault.

Usage

After Installing, log-in to the Umbraco back-office, then visit:

http://YOURSITE.COM/Umbraco/backoffice/Api/MigrationHelperApi/Start

Features

General Visibility

You can view lists of Doctypes, DataTypes, and PropertyEditors, and see what other items are referencing them. Drill-down and view raw property data.

Additionally, there is a UDI / GUID Lookup tool, which can be helpful when Umbraco Deploy says "There's an issue with artifact umb://document/3872fd27c0554761bc7e7d6e7e6ba146" and you'd like to know what Content node that is.

Data Conversion Tools

Find/Replace in PropertyData

Allows you to bulk alter a node's property's raw data directly.

  • Simple Text-to-Text - An exact replacement of the entered text inside the property data
  • Replace Integer Ids with UDIs - To update Node IDs with UDIs inside of data (for example - in the case of Nested Content or other JSON)
  • Custom Migration - use your own custom migration code (implementing interface ICustomFindReplaceDataMigrator)

Property-To-Property

Documentation TBD

Custom Data Migrators : ICustomFindReplaceDataMigrator

You can create your own custom migrators to update data inside a property. This is useful when you are dealing with changing data formats inside of NestedContent or other more complex data.

Just add a class to your project that implements interface ICustomFindReplaceDataMigrator. The two methods are simple to work with.

IsValidForData

 bool IsValidForData(int NodeId, string ContentTypeAlias,  PropertyType PropType, object OriginalData);

Here you can add whatever tests are needed to ensure that your migrator is only operating on the data you want. The calling function will provide you with the current node Id, ContentType Alias, PropertyType, and the current data in the property. You can use what you need to and ignore the rest. Use Services to get more information about the objects as needed.

Examples:

//Check that it is a specific DataType
string MyDataTypeGuid = "2274379b-de2c-4e8c-bd88-3c1fb2caa5e8";

if (PropType.DataTypeKey.ToString() == MyDataTypeGuid)
{
	return true;
}
else
{
	return false;
}

--

//Check that it is a specific Property Alias
if (PropertyType.PropertyEditorAlias == "Umbraco.NestedContent")
{
	return true;
}
else
{
	return false;
}

Your migrator will only get called if the original data in the node/property is not NULL. If your function returns "FALSE", the data will NOT be changed for that node/property.

ConvertOriginalData

 object ConvertOriginalData(object OriginalData,out string ConversionErrorMsg);

This is where you do the conversion. You can do whatever you want here, just return the "new" data. Keep in mind that you are working with the data in the raw DB format, so objects will be in JSON format, for instance, and should be Serialized before getting returned.

Use the ConversionErrorMessage to also return any messages about why data was unable to be converted. In the event of an error, you should probably return the original data unchanged. The ConversionErrorMessage will be shown in the table on the "Find Replace Results" Page

Some Tips:

  • When dealing with NestedContent or other complex object data, you should create some simple class models for deserializing to make it easier to work with your new data. The quickest way to do that is to copy some example data from the property and use https://app.quicktype.io with the "Attributes Only" option selected.

Examples: See the '~Custom Migrator Samples' folder for sample migrators

Resources

GitHub Repository: https://github.com/hfloyd/Dragonfly.Migration7To8Helpers

Product Compatible and additional computed target framework versions.
.NET Framework net472 is compatible.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.5.0 264 11/22/2023
0.4.0 426 10/24/2022
0.3.0 425 5/6/2022
0.2.0 348 8/11/2021
0.1.0 462 7/30/2020

Small fixes