Page Type migration with migration tool

Hi, we're starting our work to migrate a k13 website to Experience.

We're pretty early on and I'm currently working on migrating our page types to test page migration.

On v13, we had a page type "BasePage". it was holding a few technical fields like should this page be on the site map, SEO, ... Those kind of things. After some research, we're trying to customize the migration tool to create a reusable field schema for it and map it to our page types.

Here is our schema/registration file:

public static IServiceCollection MigratePageTypes(this IServiceCollection serviceCollection)
    {
        var schemaBuilder = BuildBasePageSchema();
        serviceCollection.AddSingleton<IReusableSchemaBuilder>(schemaBuilder);

        serviceCollection.AddSingleton<IClassMapping>(BuildArticlePressRoomMapping());
        // more of the same for each type...
        serviceCollection.AddSingleton<IClassMapping>(BuildUnsubscribeMapping());

        return serviceCollection;
    }

    private static ReusableSchemaBuilder BuildBasePageSchema()
    {
        var schemaBuilder = new ReusableSchemaBuilder(TargetClassNameBasePage, TargetDisplayNameSchema,"");
        schemaBuilder.ConvertFrom(SourceClassNameBasePage, x => x switch
            {
                SourceFieldNameBasePageIsSiteMap => TargetFieldNameBasePageIsSiteMap,
                SourceFieldNameBasePageDocumentPageTitle => TargetFieldNameBasePageDocumentPageTitle,
                SourceFieldNameBasePageDocumentPageDescription => TargetFieldNameBasePageDocumentPageDescription,
                _ => null
            }
        );

        return schemaBuilder;
    }

Generates the schema all right (missing fields tho...)


I'm having a little problem with page with only reusable fields.

They simply all crash with this message:

is missing dependency ClassInheritsFromClassID=5531 of type DataClassInfo

I'm guessing it's the fact that we don't have any fields to map the old and new table that cause this problem. Here is an example:

public static partial class PageTypeMapper
{
    private const string SourceClassNameBus = $"{SourceClassNameRoot}.Bus";

    private const string TargetBusBaseName = "Bus";

    private const string TargetClassNameBus = $"{TargetClassNameRoot}.{TargetBusBaseName}";
    private const string TargetTableNameBus = $"{TargetClassNameRoot}_{TargetBusBaseName}";

    private static MultiClassMapping BuildBusMapping()
    {
        var mapping = new MultiClassMapping(TargetClassNameBus, target =>
        {
            target.ClassName = TargetClassNameBus;
            target.ClassTableName = TargetTableNameBus;
            target.ClassDisplayName= TargetBusBaseName;
            target.ClassType = ClassType.CONTENT_TYPE;
            target.ClassContentTypeType = ClassContentTypeType.WEBSITE;
            target.ClassWebPageHasUrl = true;
        });

        mapping.BuildField($"{TargetBusBaseName}ID")
            .AsPrimaryKey();

        mapping.UseResusableSchema(TargetClassNameBasePage);

        return mapping;
    }
}

How can I map those types ?

On a parallel subject, I would have put the "IsTemplate" in SetFrom at true by default... Took me so much time to find it and I'm guessing most migration field are template fields :D


That's it. Thanks in advance and may you all have a great day :)

Tags:
Content types Migration / upgrade Software development
0

Answers

Accepted answer

I'm guessing it's the fact that we don't have any fields to map the old and new table that cause this problem.

Can confirm that. Had the idea to add a mapping to the legacy BaseName like that

mapping.BuildField(TargetFieldNameAllBaseName)
            .SetFrom(SourceClassNameUnsubscribe, SourceFieldNameAllBaseName, true);

And all my page types are built ! I know have to pass through each of them to remove the legacy field.

I'm guessing you're using the BuildField.SetFrom source table to do the mapping of the fields. Maybe this information should also be held by the MultiClassMapping ? Would allow to map tables with no fields to be migrated too.

0

Hi CDumange,

Thanks for reporting this issue and for sharing what worked for you!

The problem you encountered is documented in our deep dive guide on remodeling page types as reusable field schemas. The guide covers this exact scenario in the "Map the manual grinder content type" section, where content types contain only schema fields, not additional custom fields.

I'm glad you got it working! I completely agree that having to delete the temporary field afterward is not ideal.

If you're not already on the latest version of the migration tool, I'd recommend updating. And if you continue to experience issues on the latest version, feel free to open a bug report in the GitHub repository.

FYI: There's a feature about to be merged (GitHub issue #551) that will add a WithoutSource() method for creating fields that aren't tied to KX13 source data. While it's primarily designed to add genuinely new fields during migration, it might offer an alternative approach for this scenario once it's available in the next release.

Thanks again for sharing your experience—it helps us understand common pain points during migrations!

3

Hi Dominika

Thanks for your anwsers. Seems I read the important part a bit to quickly ^^

Gonna check to rebase or modifications on the latest version just to keep up to date.

I still have a little problem you could help me with (tell me if I should create another question).

As I pasted. my reusable schema should contain 3 fields. IsSiteMap, DocumentPageTitle, DocumentPageDescription.

It's supposed to be mapping this v13 page type that is the parent of most of our other page types

1.00

But as you can see, only the IsSitemap (and the basename) is being recreated in our schema

I thought the proble, was that we had a section checking if the page type had metadata activated that troubled us. I try removing that condition but I still can't manage to have my 3 fields. I hoped it was not used to much but seems our client are not in this line of thought ^^

Would you have an idea ? Kinda hard to debug those kind of problems.

Just to be sure as words are often treacherous, a schema !

1.00

Thanks again and have a nice day.

[Edit]

Dug deeper, seems those fields are weird. They don't show in the BasePage database (only IsSiteMap does, explaining why no problem for it).
Checked the definition and seems they were declared differently

1.00

Ok, those kind of fields are not hold by the PageType but by CMS_Document directly. So I guess, the modification should be in the --pages handlers ?

0

To response this discussion, you have to login first.