Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Luuk Peters 85 posts 331 karma points
    Dec 07, 2022 @ 12:28
    Luuk Peters
    0

    Migration: package.xml refer to content's parent by key instead of id

    To sync a lot of things between Umbraco instances, we use uSync and that works great. Content is only synced on the development machines, but any other environment (test, acc and prod) does not sync content. We don't use Cloud, so no Deploy ;)

    So when we have content that is required for the site te function, I create an automatic migration with a package.xml of the content that is required. In this case a node that contains information for the site header (like the logo, menu items etc). I removed the individual fields for this example:

    <Documents>
        <DocumentSet importMode="root">
          <header id="1094" key="0f6a6079-22b6-4c13-901a-877f2f5ddfd4" parentID="1076" level="3" creatorID="-1" sortOrder="0" createDate="2022-11-29T11:27:28" updateDate="2022-12-07T09:41:38" nodeName="Header en footer" urlName="header-en-footer" path="-1,1073,1076,1094" isDoc="" nodeType="1086" nodeTypeAlias="header" creatorName="Proud Nerds admin" writerName="Proud Nerds admin" writerID="-1" template="" isPublished="true">
    <!-- Fields here -->
          </header>
        </DocumentSet>
      </Documents>
    

    The problem is that this header node is located in a certain spot in the content tree. In the package.xml this is apparent: parentID="1076" and path="-1,1073,1076,1094"

    However....the id's between the environments are for all the nodes are not always the same. So parentID 1076 does not exist in all environments, which will place the new header node on the root level of the site.

    It there a way to match the parent by key? Or how would you guys solve this? Create the content programmatically?

Please Sign in or register to post replies

Write your reply to:

Draft