By knugar on
I've some book nodes that would prefer to convertet to ordinary story nodes. It's important that the nid does not change so I cannot just create a new node with the same content.
I found this by searching the forums:
Of these, the altertype module looks nice. Do any of you have any experiences with this and is there anything more (besides to back up before i play around) I should think about.
After a quick look at the altertype module it seems to leave "dead" rows in the book table when converting a book node to a story node. Is this a problem?
Comments
orphaned rows
Once the node type has been changed the orphaned rows in the book table probably won't hurt anything because the node relationship no longer exists. Ideally these should be cleaned up (deleted) though.
list of child pages still exists
I tested the altertype module. After changing node type from book to story the list of child nodes is still rendered at the bottom of the page. After I manually delete all related rows in the book table it goes away.
I have no idea why this is the case. A little strange that the list is output even if node.type == 'story'. The test to produce the list or not seems to look in the book table for related rows independent of the node.type.
I will try to add some book table clean-up to the altertype module.
an attempt to improve the altertype module
After playing around with the altertype module I decided to add support for:
I simply delete or insert a row into the book table when necessary. I'm not a regular PHP or Drupal coder, so feel free to comment/improve.
graceful node conversion
Without commenting on your code changes specifically, your notion of graceful node conversion is a good one. Addressing the most common node types is a good place to start.
for D5 and D6 users
For anyone using newer Drupal version, who stumbles upon this thread, there's a module Nodetype:
http://drupal.org/project/nodetype
Just keep in mind, it only changes the type so if the new type has different structure or lacks some field etc., there may be consequences...
Node Convert seems more fully featured
http://drupal.org/project/node_convert