Copied to clipboard

Flag this post as spam?

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


  • Andrew 8 posts 78 karma points
    5 days ago
    Andrew
    0

    Move a document type down one level

    Good morning,

    I wish to move a document type from the current level in the tree, down one level.

    My document type "Gallery" is currently sitting at:

    BaseDocumentType > BaseWebpage

    I wish to move it so it's parent is now StandardContent

    BaseDocumentType > BaseWebpage > StandardContent

    The problem is I have to do this on more than one server. I make the change on a local server, but then deploy to Staging and then to pre-prod after that.

    I am using uSync to control doctypes. Currently my method to get this to work is to export the Gallery doctype, delete the old doctype, edit the export file so that it contains the correct parent, then import the doctype into Umbraco again. However in the end this still Deletes the doctype in local, and a usync file is created that shows this. this means my content associated with this doctype is also deleted when I deploy this change to staging!

    Is there a nice hack you can use to trick uSync into simply moving a doctype?

    Andrew

  • Joep 7 posts 98 karma points
    5 days ago
    Joep
    1

    You could make a SQL query that changes the parent of the "Gallery" document type.

    UDATE umbracoNode set parentID={StandardContent id} WHERE id = {Gallery id}
    

    EDIT: You need to remove the relation aswell:

    DELETE FROM csmContentType2ContentType WHERE childContentTypeId = {Gallery id}
    
  • Andrew 8 posts 78 karma points
    4 days ago
    Andrew
    0

    It definitely moved the document type, but none of the inherited fields are in it.

    So I guess I'm back to square one

  • Dmitriy 138 posts 513 karma points
    5 days ago
    Dmitriy
    0

    That is one of reasons I don't use inheritance in umbraco ducument types, there is no easy way to change an inheritance hierarchy.

    Consider interface orientied approach with document types in future, it much more flexible.

    I think, Joeps advise would solve your problem as it is, please tell us if it does

  • Andrew 8 posts 78 karma points
    4 days ago
    Andrew
    0

    Okay I got it to work:

    1) Export the Gallery doctype

    2) Edit the udf export file so that it contains the correct parent

    3) Rename the old doctype to something e.g. Gallery2

    4) Import the new doctype (udf) into Umbraco.

    5) Go into the parent doctype of the content you are trying to keep, and make sure the new doctype is associated as a permission. It should now have Gallery2 and Gallery as page types

    6) Right click the node and Change document type, it should change from Gallery2 to Gallery

    7) Commit & deploy to staging

    8) Do a uSync

    Magic, your content is still there!

    9) Clean up - delete Gallery2

Please Sign in or register to post replies

Write your reply to:

Draft