Manually adding a node to Drupal 7
Sometimes, when the brown stuff has hit the proverbial, there is a need to manually insert a single node back into the database with its original node id.
For Drupal 7 it is quite easy no add one back in and end up with an empty node which can then be edited to add the information via the normal interface, but if you have the comment module installed at all, it will throw errors that you haven't got $comment_count defined even if that content type never had comments attached to it ever!
Anyway, here's the full set of SQL to add a node back into the database. Here we are insert nid 1 back into the database, which just happens to be the Privacy Policy.
INSERT node VALUES ( 1, # node id 1, # revesion id (must match next one) 'page', # node type 'und', # language 'Privacy Policy', # title 2, #uid of node creator 1, # status/publish 1322148571, #created 1322148571, #changed 0, # comment setting 1, # promote flag 0, # sticky flag 0, # translation nid 0 # translate flag ); INSERT INTO node_revision VALUES ( 1, # node nid 1, # revision id 2, # uid of user who saved this 'Privacy Policy', # title '', # log message 1322148571, # timestamp of change 1, # status/published flag 0, # comment flag 1, # promote flag 0 # sticky flag ); INSERT INTO node_comment_statistics VALUES ( 1, # node nid 0, # comment id of last comment 1292895867, # time stamp of last comment NULL, # last comment name 1, # uid of last commenter, or 1 if none 0 # comment count );