Community Documentation

To Drupal 4.7

Last updated April 6, 2007. Created by add1sun on April 6, 2007.
Log in to edit this page.

Here was my move from Postnuke to Drupal 4.7.5:

Actions performed:

1- User Migration - Complete

INSERT INTO awnewso_drupal4.users (uid, name, pass, mail, signature, timezone, mode, sort, threshold, status, init, created, access, data) SELECT pn_uid, pn_uname, pn_pass, pn_email, pn_user_sig, 0, 0, 0, 0, 1, pn_email, pn_user_regdate, UNIX_TIMESTAMP('2007-01-01 01:01:01'), "N;" FROM awnewso_awnewsorg.nuke_users WHERE pn_uid!=1;

________


Created Anonymous user in Post Nuke nuke_users. uid=663
ran:

INSERT INTO awnewso_drupal4.users (uid, name, pass, mail, signature, timezone, mode, sort, threshold, status, init, created, access, data) SELECT pn_uid, pn_uname, pn_pass, pn_email, pn_user_sig, 0, 0, 0, 0, 1, pn_email, pn_user_regdate, UNIX_TIMESTAMP('2007-01-01 01:01:01'), "N;" FROM awnewso_awnewsorg.nuke_users WHERE pn_uid=663;

--------

2 - Story Migration - Complete

INSERT INTO awnewso_drupal4.node (nid, vid, type, title, uid, status, created, comment, promote, moderate, changed)
SELECT pn_sid,
pn_sid,
"story",
CASE WHEN NOT strcmp(LEFT(pn_title,3),"_TP") THEN substring(pn_title,4) ELSE pn_title END,
pn_uid,
1,
unix_timestamp(pn_time),
2,
1,
0,
now()
FROM awnewso_awnewsorg.nuke_stories s, awnewso_awnewsorg.nuke_users u
WHERE s.pn_informant=u.pn_uname

---

INSERT INTO awnewso_drupal4.node_revisions (nid, vid, uid, title, teaser, body, log)
SELECT pn_sid,
pn_sid,
pn_uid,
pn_title,
pn_hometext,
pn_bodytext,
""
FROM awnewso_awnewsorg.nuke_stories s, awnewso_awnewsorg.nuke_users u
WHERE s.pn_informant=u.pn_uname

___________

3 - Comment Migration - Complete

INSERT INTO awnewso_drupal4.comments ( cid, pid, nid, uid, subject, comment, hostname, timestamp, homepage)
SELECT c.pn_tid,
c.pn_pid,
c.pn_sid,
IF(strcmp(c.pn_name,""),u.pn_uid, 0) ,
c.pn_subject,
c.pn_comment,
c.pn_host_name,
unix_timestamp(c.pn_date),
""
FROM awnewso_awnewsorg.nuke_comments c, awnewso_awnewsorg.nuke_users u
WHERE c.pn_name=u.pn_uname

___________

4 - Final testing.


SELECT @term_data_tid:=MAX(tid) FROM term_data;
SELECT @comments_cid:=MAX(cid) FROM comments;
SELECT @node_nid:=MAX(nid) FROM node;
SELECT @users_uid:=MAX(uid) FROM users;
SELECT @vocabulary_vid:=MAX(vid) FROM node;

DELETE FROM sequences WHERE name="term_data_tid";
DELETE FROM sequences WHERE name="comments_cid";
DELETE FROM sequences WHERE name="node_nid";
DELETE FROM sequences WHERE name="users_uid";
DELETE FROM sequences WHERE name="vocabulary_vid";

INSERT INTO sequences (name,id) SELECT "term_data_tid", @term_data_tid;
INSERT INTO sequences (name,id) SELECT "comments_cid",@comments_cid;
INSERT INTO sequences (name,id) SELECT "node_nid",@node_nid;
INSERT INTO sequences (name,id) SELECT "users_uid",@users_uid;
INSERT INTO sequences (name,id) SELECT "vocabulary_vid",@vocabulary_vid;


Comment fix:

INSERT INTO awnewso_drupal4.node_comment_statistics (nid,last_comment_timestamp,last_comment_name,last_comment_uid,comment_count)
SELECT c.pn_sid,
unix_timestamp(c.pn_date),
NULL,
IF(u.pn_uid=-1,0,u.pn_uid),
s.pn_comments
FROM awnewso_awnewsorg.nuke_comments c
LEFT JOIN awnewso_awnewsorg.nuke_users u ON c.pn_name=u.pn_uname
LEFT JOIN awnewso_awnewsorg.nuke_stories s ON c.pn_sid=s.pn_sid
LEFT JOIN awnewso_awnewsorg.nuke_comments d ON c.pn_sid=d.pn_sid AND unix_timestamp(c.pn_date)<unix_timestamp(d.pn_date)
WHERE d.pn_date IS NULL;

ONLY if your user is already in the post-nuke database.
Replace references to user who is to become admin with admin.  (move references of uid to 1)

update node set uid = replace(uid,242,1);
update node_revisions set uid = replace(uid,242,1);
update comments set uid = replace(uid,242,1);

About this page

Drupal version
Drupal 4.7.x

Installation guide

Drupal’s online documentation is © 2000-2012 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License. Comments on documentation pages are used to improve content and then deleted.