Kentico / xperience-by-kentico-kentico-migration-tool

A customizable tool that migrates older Kentico solutions to the latest version of Xperience by Kentico.
MIT License
6 stars 1 forks source link

Random slugs append on tree paths causing invalid path references #216

Closed purquhart closed 1 month ago

purquhart commented 1 month ago

The migration tool is appending a random slug to the tree path which makes all references invalid for items that we are retrieving by tree path. It also makes it so that you can't retrieve children via a certain tree path because it's children contain a different tree path. I noticed that we could modify the migration toolkit so that we could exclude the addition of that random slug - is this what we should do, or what is the recommended approach?

tkrch commented 1 month ago

Hi @purquhart, i have tried to simulate issue, but with no luck.

if i have for example page with node alias path "/Account/Login", that page is migrated with CMS_WebPageItem.WebPageItemTreePath set to "/Account/Login". Could you elaborate more on what you expect to happen with simple sample?

purquhart commented 1 month ago

@tkrch For example using two original paths as follows: /News /News/XYZ

The tree path becomes the following on the migrated instance, so I think what is happening is that when you try to do a query via PathMatch.Children(treePath), it returns 0 results because the parent path is not even close to the parent path of the child.

/News-59uwibxb /News/XYZ-6d8wydmp

tkrch commented 1 month ago

@michalJakubis i performed test migration with samples: /test-url /test-url/child-test-2

Result is webpage that looks like this: image

and web page url path like this: image

in administration it looks like this: image

tree path slug is different from code name: image

Can You verify that this behaviour is standard in XbyK? (random suffix behind code name like this Child-test-2-8prc0zak) - should this happen every time or just when codename is not unique?

michalJakubis commented 1 month ago

Hi @tkrch, yes this is standard behavior in XbK. The random suffix behind code name is being created every time you create new web page. It is not related to the uniqueness of the given code name.

tkrch commented 1 month ago

@purquhart could you post sample of migrated data in XbyK? I will check if everything is in order. Use following query to select data, where issues occurs (and please mark what is wrong):

SELECT TOP 1 *
FROM CMS_ContentItem CI
         LEFT JOIN dbo.CMS_ContentItemCommonData CCICD on CI.ContentItemID = CCICD.ContentItemCommonDataContentItemID
         LEFT JOIN dbo.CMS_WebPageItem CWPI on CI.ContentItemID = CWPI.WebPageItemContentItemID
         LEFT JOIN dbo.CMS_WebPageUrlPath CWPUP on CWPUP.WebPageUrlPathWebPageItemID = CWPI.WebPageItemID
WHERE ##TODOFILTER##
FOR XML AUTO, ROOT('CIs')

For example:

<CIs>
  <CI ContentItemID="4" ContentItemGUID="4D5971A3-853F-5818-A923-51E25C9909A0" ContentItemName="AboutUs-m0sau6r7" ContentItemIsReusable="0" ContentItemIsSecured="0" ContentItemContentTypeID="5616" ContentItemChannelID="1">
    <CCICD ContentItemCommonDataID="5" ContentItemCommonDataGUID="C4C733C7-F6FC-4A22-961A-D74517C58DCC" ContentItemCommonDataContentItemID="4" ContentItemCommonDataContentLanguageID="1" ContentItemCommonDataVersionStatus="1" ContentItemCommonDataIsLatest="1" Category_Legacy="[{&quot;Identifier&quot;:&quot;95d88417-ac58-4658-babc-ce89b35ff78b&quot;}]">
      <CWPI WebPageItemID="4" WebPageItemGUID="4D5971A3-853F-5818-A923-51E25C9909A0" WebPageItemName="AboutUs-m0sau6r7" WebPageItemTreePath="/About-Us" WebPageItemWebsiteChannelID="1" WebPageItemContentItemID="4" WebPageItemOrder="5">
        <CWPUP WebPageUrlPathID="9" WebPageUrlPath="es-ES/About-Us" WebPageUrlPathHash="47CCCBD3BCA7547E0093D5C2DD6B0962C4AC11400AA81EE48C08E79CE660B6AE" WebPageUrlPathWebPageItemID="4" WebPageUrlPathIsLatest="1" WebPageUrlPathGUID="F2EBBEC9-0A68-4DDA-9980-412EB50E2B00" WebPageUrlPathWebsiteChannelID="1" WebPageUrlPathContentLanguageID="2" WebPageUrlPathIsDraft="0" />
      </CWPI>
    </CCICD>
  </CI>
</CIs>
purquhart commented 1 month ago

Thanks @tkrch in seeing how things are working with the migration of paths, I think it's possible that this might fix itself once your #219 fix for #217 is in place, I'll redo the migration later today or tomorrow with the update in place and get back to you.

purquhart commented 1 month ago

@tkrch the random slugs on the tree path are no longer happening as of the update you applied in #219, thank you.