Usync migrations custom migrator
# help-with-umbraco
s
I am upgrading a site from v8 to v13. I am trying to build a migrator to migrate old grid editors to block grid with the code below. The content type is being created correctly with the values i provide when running the import but the properties are not. Any ideas why the properties are not being created?
Copy code
public class PromotedMigrator : GridBlockMigratorSimpleBase, ISyncBlockMigrator
 {
     public PromotedMigrator(IShortStringHelper shortStringHelper)
         : base(shortStringHelper) { }

     public string[] Aliases => new[] { "promoted" };

     public override string GetEditorAlias(ILegacyGridEditorConfig editor) => "Promoted";



     public IEnumerable<NewContentTypeInfo> AdditionalContentTypes(ILegacyGridEditorConfig editor)
     {
         var alias = this.GetContentTypeAlias(editor);

         return new NewContentTypeInfo(
             alias.ToGuid(),
             alias,
             editor.Name ?? editor.Alias!,
             $"{editor.Icon ?? "icon-book"} color-purple",
             "BlockGrid/Elements")
         {
             Description = $"Converted from Grid {editor.Name} element using custom migrator ",
             IsElement = true,
             Properties = new List<NewContentTypeProperty>
             {
                 new NewContentTypeProperty(
                     alias: "title",
                     name: "Title",
                     dataTypeAlias: "Umbraco.TextBox"
                     )
             }
         }.AsEnumerableOfOne();
     }



     public Dictionary<string, object> GetPropertyValues(GridValue.GridControl control, SyncMigrationContext context)
     {
         var val = new Dictionary<string, object>();
         var data = control.Value; // this is the JSON input value from the U8 grid

         var title = data?.Value<string>("title");

         val.Add("title", title);

         return val;
     }
 }
b
Isn't the grid migrator included in usync enough? If you tell me what custom logic you need I might be able to advise how to just decorate built in one instead of building one from scratch
2 Views