I figured it our the hard way that migrating from Drupal to WordPress is not at all easy. While numerous attempts have been made by people to create SQL scripts to make the transition easier, the structure of databases has changed over a period of time. I was following the instructions at http://www.rufuspollock.org/2005/10/10/migrating-drupal-to-wordpress/ and failed to import the posts. Thus I made my own SQL script for importing the posts. Essentially Drupal now uses an extra table called node-revisions which contains the body. Everything else goes in the table called node.
Here’s the script. “wp” is the name of the wordpress database and “drupal” is the name of the drupal database.
INSERT INTO wp23.wp_posts (
ID, post_author, post_date, post_date_gmt, post_content, post_title, post_excerpt, post_name, post_modified, post_modified_gmt, post_type)
SELECT node.nid, node.uid, FROM_UNIXTIME(node.created), FROM_UNIXTIME(node.created), node_revisions.body, node.title, node_revisions.teaser, concat('node/', node.nid), FROM_UNIXTIME(node.changed), FROM_UNIXTIME(node.changed),'page'
FROM drupal.node, drupal.node_revisions WHERE node.type = 'page' AND node.nid = node_revisions.nid
Use it in conjunction with the other scripts to import comments, etc.
Articles, Code Snippets