Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Started down a dark path looking at converting existing content types from an inherited to composed structure - I know there's nothing fundamentally 'wrong' with inheritance, but compositions are much more flexible, so it's a dark path I need to tread.
So far, I've done this:
I could run though every node via the content service, change the type, republish, wait, and go again. That's going to take a while with 20k nodes in the site. Too slow.
Instead, I've tried this:
update cmsContent set contentType = Temp.NewTypeId from Temp where Temp.OldTypeId = cmsContent.contentType
This doesn't update the cmsContentXml table, but contentService.RebuildXmlStructures() will, eventually.
And this is where it all falls over. The backoffice still loads the tree nicely, the nodes are all of the new content type, but they don't have any data.
So there's an additional step that I'm missing and would love someone to point me towards it...
NINJA-EDIT: Using the backoffice UI to switch types works fine, so the issue is the db stuff, not the content types themselves.
Maybe you can have a look on how Umbraco handles changing doctypes on existing nodes. There is a change doctype context menu action.
Hey Dave, I've had a dig into how it's managed when calling changeContentType on an IContent item, but didn't get far - there's a simple update to the content type ID, but there must be more going on to update XML etc.
Was hoping to find an SQL way of doing it, really just for the performance benefits.
If you look at the code you probably can work out the database queries.
Probably Chauffeur would be a good option to do this, so you can run it outside of a web context.
But I have a suspiscion you are already doing that
Ultimately, yes, outside web context - it's 27k publish operations, so if I can avoid 27k calls to contentservice I'll be happy...
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted