[jboss-svn-commits] JBL Code SVN: r23749 - labs/jbosslabs/trunk/portal-extensions/jboss-forums-migration.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Nov 6 06:49:48 EST 2008
Author: szimano
Date: 2008-11-06 06:49:48 -0500 (Thu, 06 Nov 2008)
New Revision: 23749
Added:
labs/jbosslabs/trunk/portal-extensions/jboss-forums-migration/migrate-custom.sql
labs/jbosslabs/trunk/portal-extensions/jboss-forums-migration/sedit.sh
Log:
custom databases
Added: labs/jbosslabs/trunk/portal-extensions/jboss-forums-migration/migrate-custom.sql
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jboss-forums-migration/migrate-custom.sql (rev 0)
+++ labs/jbosslabs/trunk/portal-extensions/jboss-forums-migration/migrate-custom.sql 2008-11-06 11:49:48 UTC (rev 23749)
@@ -0,0 +1,43 @@
+--How to
+-- 1) put forums
+-- 2) Update forums number with procedure countForums(from, to)
+-- 3) Put topics(thread)
+-- 4) Check nonexisting users and migrate them
+-- 5) Get posts
+-- 6) Fix posts modify date
+
+-- put forums
+insert into ${CS}.jiveCommunity
+ (communityID, name, displayName, description, creationDate, modificationDate, lft, rgt, localeCode, workflowID, modDfltThreadVal, modDfltMsgVal, contentTypes)
+ select n.forum_id, n.forum_name, n.forum_name, n.forum_desc, 0,0,1,6,NULL, -1,1,1,7 from ${NUKES3}.phpbb_forums n;
+
+
+-- put topics
+insert into ${CS}.jiveThread
+ (threadID, containerType, containerID, rootMessageID, modValue, rewardPoints, creationDate, modificationDate, status)
+ select p.topic_id,14,p.forum_id,p.topic_first_post_id,1,0,UNIX_TIMESTAMP(p.topic_time)*1000,UNIX_TIMESTAMP(p.topic_last_post_time)*1000,2 from phpbb_topics p;
+
+-- delete threads
+delete from ${CS}.jiveThread where ${CS}.jiveThread.threadID != 1001;
+
+-- get posts
+insert into ${CS}.jiveMessage
+ (messageID, parentMessageID, threadID, containerType, containerID, userID, subject, body, modValue, rewardPoints, creationDate, modificationDate, status)
+ select p.post_id,NULL,p.topic_id,14,p.forum_id,cu.userID,p.post_subject,p.post_text,1,0,UNIX_TIMESTAMP(p.post_time)*1000,UNIX_TIMESTAMP(p.post_edit_time)*1000,2
+ from ${NUKES3}.phpbb_posts p, ${NUKES3}.nuke_users nu, ${CS}.jiveUser cu
+ where p.poster_id = nu.pn_uid and nu.pn_uname = cu.username
+
+-- check notexisting users
+select distinct pp.poster_id, nu.pn_uname from ${NUKES3}.phpbb_posts pp, ${NUKES3}.nuke_users nu
+ where pp.poster_id = nu.pn_uid
+ and not exists (select * from ${CS}.jiveUser cu where nu.pn_uname = cu.username);
+
+-- after geting all of them we have to migrate those that do not exist in the db
+
+-- delete posts
+delete from ${CS}.jiveMessage where ${CS}.jiveMessage.messageID != 1001 and ${CS}.jiveMessage.messageID != 1002;
+
+-- update modif dates (when = 0)
+update ${CS}.jiveMessage SET modificationDate=${CS}.jiveMessage.creationDate where ${CS}.jiveMessage.modificationDate = 0;
+
+
Added: labs/jbosslabs/trunk/portal-extensions/jboss-forums-migration/sedit.sh
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/jboss-forums-migration/sedit.sh (rev 0)
+++ labs/jbosslabs/trunk/portal-extensions/jboss-forums-migration/sedit.sh 2008-11-06 11:49:48 UTC (rev 23749)
@@ -0,0 +1,5 @@
+#!/bin/bash
+CS="s/\${CS}/$1/g"
+NUKES="s/\${NUKES3}/$2/g"
+
+sed $CS migrate-custom.sql | sed $NUKES > new_migrate.sql
Property changes on: labs/jbosslabs/trunk/portal-extensions/jboss-forums-migration/sedit.sh
___________________________________________________________________
Name: svn:executable
+ *
More information about the jboss-svn-commits
mailing list