Revisions overhaul
This change affects your module if you do direct SQL operations on node body or teaser fields, or if your module provides a node type and stores the node type's extra information in its own table.
Fields moved from node table to node_revisions table
Before Drupal 4.7 the node table included body and teaserfields. As of 4.7, these fields are moved into the node_revisions table. If you have SQL statements referencing these fields, you will have to rewrite your SQL to refer to the node_revisions table. Typically, you'll do an additional join of node on node_revisions. Here's an example from blog.module.
The 4.6 version:
<?php
$result = db_query_range(db_rewrite_sql("SELECT n.nid, n.title, n.teaser, n.created, u.name, u.uid FROM {node} n INNER JOIN {users} u ON n.uid = u.uid WHERE n.type = 'blog' AND u.uid = %d AND n.status = 1 ORDER BY n.created DESC"), $uid, 0, 15);
?>And the 4.7:
<?php
$result = db_query_range(db_rewrite_sql("SELECT n.nid, n.title, r.teaser, n.created, u.name, u.uid FROM {node} n INNER JOIN {node_revisions} r ON n.vid = r.vid INNER JOIN {users} u ON n.uid = u.uid WHERE n.type = 'blog' AND u.uid = %d AND n.status = 1 ORDER BY n.created DESC"), $uid, 0, variable_get('feed_default_items', 10));
?>Making your module revisions aware
This change has no influence on your node modules unless you want the information to be revisions aware.
Until Drupal 4.6 we used the node ID (nid) as a sole reference for any given node. As of Drupal 4.7 we have both a node ID and a version ID (vid). There can be several vids for each nid, one per revision. There is always at least one vid per nid. The vids are unique within one Drupal install.
Let us assume your module is named foo.module and provides the 'foo' node type. The extra information is stored in an extra table:
nid | foo
In order to take advantage of the new revisioning capabilities you need to change it to
vid | foo
The old nid values will become vid values; the actual value will not change. You, of course, need to change any JOINs that you perform in the nodeapi hook and other hooks. Instead of joining on nid you join on vid. The same applies to SELECTs.
If you do not want to take advantage of the revisioning system you can just leave everything as it is and the extra information provided by your module will be shared across all revisions of a given node.
If you already used revisions before this overhaul you will notice that they seem to be lost after you run the upgrade script. This is not the case. The old revisions are stored in the old_revisions table and will be made available again by a forthcoming update.
The development history of this revisions overhaul is found in this issue: http://drupal.org/node/7582
