Copied to clipboard

Flag this post as spam?

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


  • suzyb 474 posts 932 karma points
    Oct 23, 2013 @ 23:53
    suzyb
    0

    Changing document type

    Bit of background, a client changed the way they did business after we developed a site for them. Because no time (or money) was given to updating the site the client used an existing document type for a new type of page.

    Now we've been given the time (and money) to redevelop the site. And I would like to change the pages that use this wrong document type to a new more appropriate one. As there isn't a way to do this through the CMS I'm trying to directly update the database. Bad idea I know but there are probably 100+ documents that need changed.

    I've tried updating the cmsContent table and changing the contentType however the property values aren't filled in, even though both document types have the same properties.

    How do I need to change the properties table(s) so the property values get filled in. Or can anyone suggest another way of changing the document type of pages.

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Oct 24, 2013 @ 12:15
    Jeroen Breuer
    0

    Hello,

    What version are you on? In v6 it's already possible to give a node a new document type through the API: http://issues.umbraco.org/issue/U4-79

    In Umbraco 6.2.0 it will even be possible through the UI: http://issues.umbraco.org/issue/U4-1468

    Jeroen

  • suzyb 474 posts 932 karma points
    Oct 24, 2013 @ 14:28
    suzyb
    0

    The site uses 4.11.10 sadly.

    I thought I had figured out how to do it by updating the propertytypeid value in the cmsPropertyData table to the ones for the new document type. But it's still not filling in the property values in the CMS :(

    -e- Hold on, some of the property values are showing.

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Oct 24, 2013 @ 14:29
    Jeroen Breuer
    0

    Maybe you can have a look at the V6 source to see how it's done there.

    Jeroen

  • suzyb 474 posts 932 karma points
    Oct 24, 2013 @ 17:26
    suzyb
    0

    Has the database changed between version 4 and 6. I'm wonder whether I could use the v6 code to update my database.

    Updating the database directly has updated some of the pages successfully but not others. I think it may be something to do with pages having multiple versions but can't see what.

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Oct 24, 2013 @ 17:50
    Jeroen Breuer
    0

    Here is a list of the changes between v4 and v6: http://issues.umbraco.org/issue/U4-1353#comment=67-4673

    Jeroen

  • suzyb 474 posts 932 karma points
    Oct 25, 2013 @ 11:08
    suzyb
    0

    OK I restored a backup taken before I started trying to change the doc type and started again. And this time (fingers and everything else that can be, crossed) it seems to have worked, the pages are all showing their properties.

    For reference this is what I did

    1. I created a single column temp table and added the node id of the nodes that needed changed to it.

    2. I then created another table that mapped the property id of the properties in the original doc type to those of the new one.

    3. Updated the cmsContent table

    Update cmsContent set contentType = 25395 where nodeid in (select nodeid from temp_changenodes)

    1. Updated the cmsPropertyData table to change the property ids to the new ones.

    UPDATE cmsPropertyData SET propertytypeid = NewPropertyID FROM tempchangeproperties INNER JOIN cmsPropertyData ON OldPropertyID = propertytypeid WHERE contentNodeId in (select nodeid from tempchangenodes)

    1. Then I went to this page http://mydevurl/Umbraco/dialogs/republish.aspx?xml=true to get the xml in the cmsContentXml table to update.

    (meh it's messed up my list numbers)

  • suzyb 474 posts 932 karma points
    Oct 25, 2013 @ 20:24
    suzyb
    0

    oh and I think the reason some of the page's properties weren't showing up was because I viewed those page in the CMS after I changed their doctype but before I updated the property IDs.

Please Sign in or register to post replies

Write your reply to:

Draft