I have two content types from 4.7 cck which have a textfield called "article" and no body field. I'd like to merge these with another content type, that uses the "body" field - otherwise they're identical.
What I'm not sure about is the best way to take the information from the content_field_myfield table and put it into node_revisions. I don't need teasers (we have another text field which provides that), and not that worried about uid, although it'd be nice. The main thing is getting the data into body, and updating with the relevant title from the node table.
I should note there's about 1,800 nodes in these content types, so manual isn't an option. I think it's just be a select from with a join to node for the title, uid etc., then an insert into node_revisions with that data, but can't get my head around how it'd work.
Comments
Comment #1
yched commentedWell, this is more a question of how to correctly fill core node and node_revisions tables than a strictly cck-related question, am i right ?
I guess I'd brute-force change the node.type column to your_target_type, and copy the text field's _value and _format columns to node_revisions.body and node_revisions.format columns.
in pseudo code, something like :
Completely untested, of course :-)
Comment #2
catchThanks for this yched, I won't be able to get this going for a couple of weeks yet, but will report back when I've got it working (or got stuck). Yes it's as much a question about how to fill those tables as cck, but I figured it was (possibly) a common issue for people who've been using it for a while.
Comment #3
yched commentedOK, marking as fixed for now, then.
Comment #4
(not verified) commentedComment #5
catchOK so I tried to do this with db_query / db_fetch_array and got confused.
Ended up doing it with brute force SQL which turned out to be incredibly straightforward and fine for my purposes, also saved having to worry about a foreach loop through a couple thousand records.
After this you need to hide article in content types -> display, for each type that uses it, and also edit each one to use the body field.
Obviously you'd have to change content_field_article and field_article_value to whatever they are for your field.
yched thanks for your help with this!
Comment #6
(not verified) commented