hello

I converted from Joomla 1.0.x series to Drupal 6.x. Everything was ok.
I have one question. How can I change content types from one content types to some others.
Generally I have story content type. I would like to have some articles from story to be in type1 content type,
some to be in type2 content type etc. The question is how to make mass change and get it as I would like it?
That's what I have is all my story content type articles are in taxonomy terms. So I would like to have term1 articles
to be type1 content type and term2 articles to be in type1 content type.

So I know how to mask terms to diffrent content types but I don't know how to change it in mass change.

Any idea?

Comments

jeffjohnvol’s picture

Not sure if this would work, but first, download the backup and migrate project and back up your database. Its real easy, it allows you to save your sql restore file on your HD. Restore works well too.

If your content types aren't very different (not many extra CCK fields etc) you can try to do an update on the node:

UPDATE node
SET TYPE='NEW_TYPE'
WHERE TYPE='OLD_TYPE'

If it doesn't work, restore your database to erase the experiment.

enjoy777’s picture

THX jeffjohnvol

But I didn't have it in such way as you wrote.
In the easiest way yes I think you are right, but the main problem is that I have one OLD_TYPE and several NEW_TYPEs.
So in other words some parts of OLD_TYPE should be NEW_TYPE1 and some NEW_TYPE2 and NEW_TYPE3 ...
Which part from OLD_TYPE should be eg. NEW_TYPE1 I can point by terms from taxonomy.
I am not a mysql expert and I don't know DB scheme of Drupal 6 but it should be something like this:

UPDATE node
SET TYPE='NEW_TYPE1'
WHERE ARTICLES FROM OLD_TYPE BELONGS TO TERM1 FROM DICTIONARY1

I don't have any special fields from CCK because I gonna add them after above conversion.

jeffjohnvol’s picture

I can help you with the SQL if I knew more about the tables. You can do something like:

update node
set type='NEW_TYPE1'
WHERE type = 'OLD_TYPE1'
AND nid in (SELECT nid FROM node WHERE ucase(title) like '%CARS%')

as an example. The TERM1 and DICTIONARY1, which tables are those?

another option which is a little more difficult is to dump your node table to a spreadsheet, sort it in the order you want, so all of your nid values are in one place. If you can put them in a comma delimited list, you can do something like this:

update node
set type='NEW_TYPE1'
WHERE nid in (23, 45, 78, 92, 156);

The above sql will set the IDs for nodes that have nid values of 23, 45, 78, 92 and 156. You would provide your own numbers.

Good luck.

enjoy777’s picture

update node
set type='NEW_TYPE1'
WHERE type = 'OLD_TYPE1'
AND nid in (SELECT nid FROM node WHERE ucase(title) like '%CARS%')

as an example. The TERM1 and DICTIONARY1, which tables are those?

Yes it will probably do this job. I am not sure perhaps 'term_node' table maybe some other. Probably I shouldn't work with WHERE ucase(title) like '%CARS%' but rather eg. WHERE vid/nid/tid = 5. I don't know yet Drupal dbase schema enaugh :)

Second solution is probably ok but when you have small quantity of nodes.

So jeffjohnvol thanks again for some other reasons I decided to delete this part of my content so at this time I don't have anything to convert from one type of content to another.
So this topic can be closed.