Migrating from Geeklog 1.4.1 to Durpal 5.x
Last modified: February 19, 2007 - 00:37
How to migrate stories:
1. Backup Geeklog and Drupal databases.
2. Run the following query in the "node" table of your Drupal db:
SELECT * FROM `node` WHERE 1
3. Look at the resulting table to find the next available "nid"/"vid" number. If you want, you can save the resulting data for later reference.
4. Run this query in the Geeklog db:
SELECT
'' as nid,
'' as vid,
'story' as type,
title,
'1' as uid,
'1' as status,
unix_timestamp(date),
unix_timestamp(date),
'0' as comment,
frontpage,
'0' as moderate,
featured
from gl_storiesThis query assigns all of the user IDs to your primary Drupal account. To get the correct user ID, run the query with
uid instead of '1' as uid. You will need to ensure the users map correctly from Geeklog to Drupal, otherwise this will cause problems in your Drupal install.This also disables comments on the stories. To pull the actual comment code information, use
commentcode instead of '0' as comment. You will need to change all instances of -1 for this field to 0.This query assumes all stories in your db have been approved.
5. Export as SQL and save it as a text file (suggested name: node.txt or node.sql).
6. Delete everything up to the first
INSERT INTO...7. Replace
INSERT INTO `gl_stories`with
INSERT INTO `node`8. Run this query in the Geeklog db:
SELECT
'' as nid,
'' as vid,
'1' as uid,
title,
bodytext,
introtext,
'' as log,
unix_timestamp(date),
'1' as format
from gl_storiesThis query assigns all of the user IDs to your primary Drupal account. To get the correct user ID, run the query with
uid instead of '1' as uid. You will need to ensure the users map correctly from Geeklog to Drupal, otherwise this will cause problems in your Drupal install.Note that this query will be mapping the intro text as the trimmed version of your articles and body text as the full version. For my own migration, I had to move the text in the body into the intro text and map it to both the trimmed and full version.
9. Export as SQL and save it as a text file (suggested name: node_revisions.txt or node_revisions.sql).
10. Delete everything up to the first
INSERT INTO...11. Replace
INSERT INTO `gl_stories`with
INSERT INTO `node_revisions`12. Run this query in the Geeklog db:
SELECT
'' as nid,
tid
from gl_stories13. Export as SQL and save it as a text file (suggested name: term_node.txt or term_node.sql).
14. Delete everything up to the first
INSERT INTO...15. Replace
INSERT INTO `gl_stories`with
INSERT INTO `term_node`16. For each of the three files, you will need to manually insert the "nid" and "vid" values, starting with the next available number you determined from step 3. The "nid" and "vid" values should be the same for each line, but different between the lines. For example, if the next available "nid" value is 10, the "nid" and "vid" for the first line in all three files should be "10"; the second line in all three files should have "11" as the "nid" and "vid".
Those of you with hundreds of stories will want to find some way to convert the data to a spreadsheet and assign the numbers through it. Be careful to not take a shortcut and export the tables as a spreadsheet---the data will not be converted into the proper SQL syntax to be imported later.
17. In your term_node data, replace the Geeklog "tid" values with the numerical equivalent from your Drupal db. If you're not sure what those values are, run the following query in your Drupal db and match the numbers with what you got in step 3:
SELECT * FROM `term_node` WHERE 118. Go to phpMyAdmin for your Drupal database and import your three files.
19. Check your site to ensure everything worked.
20. If there are links in your stories, you will need to update these manually after importing them.

Missed a table
It looks like I missed a table.
You will also need to do the following:
1. Run this query in the Geeklog db:
SELECT'1' as uid,
'' as nid,
unix_timestamp(date)
from gl_stories
This query assigns all of the user IDs to your primary Drupal account. To get the correct user ID, run the query with
uidinstead of'1' as uid. You will need to ensure the users map correctly from Geeklog to Drupal, otherwise this will cause problems in your Drupal install.2. Manually insert the nid numbers to match what you did for the others above.
3. Replace
INSERT INTO `gl_stories`with
INSERT INTO `history`4. Go to phpMyAdmin for your Drupal database and import the file.
However, there is still something missing!
When I tried to create new content, I am getting the following error ("11" was the next available nid, and I have edited the error message a bit for security reasons):
* user warning: Duplicate entry '11-11' for key 1 query: INSERT INTO node (nid, vid, title, type, uid, status, created, changed, comment, promote, sticky) VALUES (11, 11, 'new title', 'page', 1, 1, 1171932926, 1171932926, 0, 0, 0) in /path/to/drupal/includes/database.mysql.inc on line 172.* user warning: Duplicate entry '11' for key 1 query: INSERT INTO node_revisions (nid, vid, title, body, teaser, timestamp, uid, format, log) VALUES (11, 11, 'new title', 'populate later\r\n', 'populate later\r\n', 1171932926, 1, 1, '') in /path/to//drupal/includes/database.mysql.inc on line 172.
Does anyone know what I'm missing?
Update your sequences table
http://drupal.org/node/6906#comment-10473
(this is a late response but added for the benefit of those who are still migrating)