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.
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.
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.
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
I created a single column temp table and added the node id of the nodes that needed changed to it.
I then created another table that mapped the property id of the properties in the original doc type to those of the new one.
Updated the cmsContent table
Update cmsContent set contentType = 25395 where nodeid in (select
nodeid from temp_changenodes)
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)
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.
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.
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
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.
Maybe you can have a look at the V6 source to see how it's done there.
Jeroen
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.
Here is a list of the changes between v4 and v6: http://issues.umbraco.org/issue/U4-1353#comment=67-4673
Jeroen
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
I created a single column temp table and added the node id of the nodes that needed changed to it.
I then created another table that mapped the property id of the properties in the original doc type to those of the new one.
Updated the cmsContent table
(meh it's messed up my list numbers)
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.
is working on a reply...