'int', 'not null' => TRUE, 'default' => 0)); db_add_field($ret, 'node', 'last_activity_uid', array('type' => 'int', 'not null' => TRUE, 'default' => 0)); db_add_field($ret, 'node', 'comment_count', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0)); $ret[] = update_sql('UPDATE {node} n INNER JOIN {node_comment_statistics} ncs ON ncs.nid = n.nid SET n.last_activity_timestamp = GREATEST(n.created, ncs.last_comment_timestamp), n.last_activity_uid = ncs.last_comment_uid, n.comment_count = ncs.comment_count'); db_drop_table($ret, 'node_comment_statistics'); $ret[] = update_sql('UPDATE {node} n SET last_activity_timestamp = created WHERE last_activity_timestamp = 0'); $ret[] = update_sql('UPDATE {node} n SET last_activity_uid = uid WHERE last_activity_uid = 0'); // Merge {node_counter} into {node} db_add_field($ret, 'node', 'views_total', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'size' => 'big')); db_add_field($ret, 'node', 'views_today', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0, 'size' => 'medium')); db_add_field($ret, 'node', 'last_viewed_timestamp', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'default' => 0)); $ret[] = update_sql('UPDATE {node} n INNER JOIN {node_counter} nc ON nc.nid = n.nid SET n.views_total = nc.totalcount, n.views_today = nc.todaycount, n.last_viewed_timestamp = nc.last_viewed_timestamp'); db_drop_table($ret, 'node_counter'); return $ret; }