[jboss-svn-commits] JBL Code SVN: r13278 - in labs/jbosslabs/trunk/portal-extensions/forge-forums/scripts/toPortal26: new and 1 other directory.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Mon Jul 9 18:21:23 EDT 2007


Author: dejp
Date: 2007-07-09 18:21:23 -0400 (Mon, 09 Jul 2007)
New Revision: 13278

Added:
   labs/jbosslabs/trunk/portal-extensions/forge-forums/scripts/toPortal26/new/
   labs/jbosslabs/trunk/portal-extensions/forge-forums/scripts/toPortal26/new/migration
   labs/jbosslabs/trunk/portal-extensions/forge-forums/scripts/toPortal26/new/migration-common.sql
   labs/jbosslabs/trunk/portal-extensions/forge-forums/scripts/toPortal26/new/migration-fix.sql
   labs/jbosslabs/trunk/portal-extensions/forge-forums/scripts/toPortal26/new/migration-forum.sql
   labs/jbosslabs/trunk/portal-extensions/forge-forums/scripts/toPortal26/new/migration-portal-keys.sql
   labs/jbosslabs/trunk/portal-extensions/forge-forums/scripts/toPortal26/new/migration-portal-pure.sql
Log:
forums migration scripts

Added: labs/jbosslabs/trunk/portal-extensions/forge-forums/scripts/toPortal26/new/migration
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-forums/scripts/toPortal26/new/migration	                        (rev 0)
+++ labs/jbosslabs/trunk/portal-extensions/forge-forums/scripts/toPortal26/new/migration	2007-07-09 22:21:23 UTC (rev 13278)
@@ -0,0 +1,54 @@
+#!/bin/bash
+
+USER=root
+PASSWORD=root
+DATABASE=nukes3
+
+FORUM_IDS=
+
+usage="\
+Usage: migration [-c] forumId [forumId]"
+
+if test "$#" -eq 0; then
+  echo "${usage}"
+  exit 2
+fi
+
+for ARG in "$@"
+do
+  case "$ARG" in
+    -*) if test "-c" = "$ARG"; then
+
+mysql -u $USER -p$PASSWORD -D $DATABASE <<QUERY_INPUT
+
+\. migration-portal-pure.sql
+
+\. migration-common.sql
+
+\. migration-portal-keys.sql
+
+QUERY_INPUT
+
+        fi ;;
+    *)  FORUM_IDS="$FORUM_IDS $ARG" ;;
+  esac
+done
+
+if test -n "$FORUM_IDS"; then
+  set $FORUM_IDS
+
+  for FORUM_ID in "$@"
+  do
+
+mysql -u $USER -p$PASSWORD -D $DATABASE <<QUERY_INPUT
+
+SET @forumId := '$FORUM_ID';
+
+\. migration-forum.sql
+
+\. migration-fix.sql
+
+QUERY_INPUT
+
+  done
+fi


Property changes on: labs/jbosslabs/trunk/portal-extensions/forge-forums/scripts/toPortal26/new/migration
___________________________________________________________________
Name: svn:executable
   + *

Added: labs/jbosslabs/trunk/portal-extensions/forge-forums/scripts/toPortal26/new/migration-common.sql
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-forums/scripts/toPortal26/new/migration-common.sql	                        (rev 0)
+++ labs/jbosslabs/trunk/portal-extensions/forge-forums/scripts/toPortal26/new/migration-common.sql	2007-07-09 22:21:23 UTC (rev 13278)
@@ -0,0 +1,132 @@
+-- DB CONVERT SCRIPT OF NUKES3 FORUMS TO PORTAL FORUMS W/ USERS TABLE
+
+-- Copying data from users (into users and posters).
+-- To make things easy, we assume that poster id == user id.
+INSERT INTO jbp_users (jbp_uid, jbp_uname, jbp_givenname, jbp_familyname,
+			jbp_password, jbp_realemail, jbp_fakeemail, jbp_regdate,
+			jbp_viewrealemail, jbp_enabled)
+	SELECT n.pn_uid, n.pn_uname, n.pn_name, n.pn_fname,
+		n.pn_pass, n.pn_email, n.pn_femail, n.pn_user_regdate,
+		n.pn_user_viewemail, n.pn_enabled 
+		FROM nuke_users n LEFT OUTER JOIN jbp_users ON
+		jbp_users.jbp_uid WHERE jbp_users.jbp_uid IS NULL;
+
+-- TODO: update givenname/ familyname
+
+INSERT INTO jbp_forums_posters (jbp_id, jbp_user_id, jbp_post_count)
+	SELECT n.pn_uid, n.pn_uid, 0 FROM nuke_users n LEFT OUTER JOIN jbp_forums_posters ON
+		jbp_forums_posters.jbp_id WHERE jbp_forums_posters.jbp_id IS NULL;
+
+-- Copying data from categories.
+INSERT INTO jbp_forums_categories (jbp_id, jbp_order, jbp_title)
+	SELECT n.cat_id, n.cat_order, n.cat_title
+	FROM phpbb_categories n LEFT OUTER JOIN jbp_forums_categories ON
+	jbp_forums_categories.jbp_id WHERE jbp_forums_categories.jbp_id IS NULL;
+
+-- Updating the "admin" account to be the same as on labs.
+UPDATE jbp_users SET jbp_password = "21232f297a57a5a743894a0e4a801fc3" WHERE jbp_uname = "admin";
+
+-- Creating the "Admin" and "User" roles.
+INSERT INTO jbp_roles (jbp_rid, jbp_name, jbp_displayname) VALUES (1, "Admin", "Administrators") ON DUPLICATE KEY UPDATE jbp_name=VALUES(jbp_name), jbp_displayname=VALUES(jbp_displayname);
+INSERT INTO jbp_roles (jbp_rid, jbp_name, jbp_displayname) VALUES (2, "User", "Users") ON DUPLICATE KEY UPDATE jbp_name=VALUES(jbp_name), jbp_displayname=VALUES(jbp_displayname);
+
+-- Assigning everybody to the "User" role.
+INSERT INTO jbp_role_membership (jbp_rid, jbp_uid)
+	SELECT 2, p.jbp_uid FROM jbp_users p
+	LEFT OUTER JOIN jbp_role_membership ON
+	jbp_role_membership.jbp_uid WHERE jbp_role_membership.jbp_uid IS NULL;
+
+-- Assigning "admin" to the "Admin" role.
+INSERT INTO jbp_role_membership (jbp_rid, jbp_uid)
+	SELECT 1, p.jbp_uid FROM jbp_users p 
+	WHERE p.jbp_uname = "admin" AND NOT EXISTS 
+	(SELECT m.jbp_uid FROM jbp_role_membership m WHERE m.jbp_rid = 1 AND m.jbp_uid = 
+		(SELECT jbp_uid FROM jbp_users WHERE jbp_uname = "admin"));
+
+-- Importing user properties.
+INSERT INTO jbp_user_prop (jbp_uid, jbp_name, jbp_value)
+	SELECT n.pn_uid, "portal.user.im.aim", n.pn_user_aim
+		FROM nuke_users n
+		WHERE n.pn_user_aim IS NOT NULL AND NOT EXISTS
+		(SELECT jbp_uid FROM jbp_user_prop WHERE jbp_name = "portal.user.im.aim" AND jbp_uid = n.pn_uid);
+
+INSERT INTO jbp_user_prop (jbp_uid, jbp_name, jbp_value)
+	SELECT n.pn_uid, "portal.user.im.icq", n.pn_user_icq
+		FROM nuke_users n
+		WHERE n.pn_user_icq IS NOT NULL AND NOT EXISTS
+		(SELECT jbp_uid FROM jbp_user_prop WHERE jbp_name = "portal.user.im.icq" AND jbp_uid = n.pn_uid);
+
+INSERT INTO jbp_user_prop (jbp_uid, jbp_name, jbp_value)
+	SELECT n.pn_uid, "portal.user.im.msnm", n.pn_user_msnm
+		FROM nuke_users n
+		WHERE n.pn_user_msnm IS NOT NULL AND NOT EXISTS 
+		(SELECT jbp_uid FROM jbp_user_prop WHERE jbp_name = "portal.user.im.msnm" AND jbp_uid = n.pn_uid);
+
+INSERT INTO jbp_user_prop (jbp_uid, jbp_name, jbp_value)
+	SELECT n.pn_uid, "portal.user.interests", n.pn_user_intrest
+		FROM nuke_users n
+		WHERE n.pn_user_intrest IS NOT NULL AND NOT EXISTS
+		(SELECT jbp_uid FROM jbp_user_prop WHERE jbp_name = "portal.user.interests" AND jbp_uid = n.pn_uid);
+
+INSERT INTO jbp_user_prop (jbp_uid, jbp_name, jbp_value)
+	SELECT n.pn_uid, "portal.user.homepage", n.pn_url
+		FROM nuke_users n
+		WHERE n.pn_url IS NOT NULL AND NOT EXISTS
+		(SELECT jbp_uid FROM jbp_user_prop WHERE jbp_name = "portal.user.homepage" AND jbp_uid = n.pn_uid);
+
+INSERT INTO jbp_user_prop (jbp_uid, jbp_name, jbp_value)
+	SELECT n.pn_uid, "portal.user.occupation", n.pn_user_occ
+		FROM nuke_users n
+		WHERE n.pn_user_occ IS NOT NULL AND NOT EXISTS
+		(SELECT jbp_uid FROM jbp_user_prop WHERE jbp_name = "portal.user.occupation" AND jbp_uid = n.pn_uid);
+
+INSERT INTO jbp_user_prop (jbp_uid, jbp_name, jbp_value)
+	SELECT n.pn_uid, "portal.user.signature", n.pn_user_sig
+		FROM nuke_users n
+		WHERE n.pn_user_sig IS NOT NULL AND NOT EXISTS
+		(SELECT jbp_uid FROM jbp_user_prop WHERE jbp_name = "portal.user.signature" AND jbp_uid = n.pn_uid);
+
+INSERT INTO jbp_user_prop (jbp_uid, jbp_name, jbp_value)
+	SELECT n.pn_uid, "portal.user.im.yim", n.pn_user_yim
+		FROM nuke_users n
+		WHERE n.pn_user_yim IS NOT NULL AND NOT EXISTS
+		(SELECT jbp_uid FROM jbp_user_prop WHERE jbp_name = "portal.user.im.yim" AND jbp_uid = n.pn_uid);
+
+INSERT INTO jbp_user_prop (jbp_uid, jbp_name, jbp_value)
+	SELECT n.pn_uid, "portal.user.time-zone-offset", n.pn_timezone_offset
+		FROM nuke_users n
+		WHERE n.pn_timezone_offset IS NOT NULL AND NOT EXISTS
+		(SELECT jbp_uid FROM jbp_user_prop WHERE jbp_name = "portal.user.time-zone-offset" AND jbp_uid = n.pn_uid);
+
+INSERT INTO jbp_user_prop (jbp_uid, jbp_name, jbp_value)
+	SELECT n.pn_uid, "portal.user.location", n.pn_user_from
+		FROM nuke_users n
+		WHERE n.pn_user_from IS NOT NULL AND NOT EXISTS
+		(SELECT jbp_uid FROM jbp_user_prop WHERE jbp_name = "portal.user.location" AND jbp_uid = n.pn_uid);
+
+INSERT INTO jbp_user_prop (jbp_uid, jbp_name, jbp_value)
+	SELECT n.pn_uid, "portal.user.security.answer", n.pn_answer
+		FROM nuke_users n
+		WHERE n.pn_answer IS NOT NULL AND NOT EXISTS
+		(SELECT jbp_uid FROM jbp_user_prop WHERE jbp_name = "portal.user.security.answer" AND jbp_uid = n.pn_uid);
+
+INSERT INTO jbp_user_prop (jbp_uid, jbp_name, jbp_value)
+	SELECT n.pn_uid, "portal.user.security.question", n.pn_question
+		FROM nuke_users n
+		WHERE n.pn_question IS NOT NULL AND NOT EXISTS
+		(SELECT jbp_uid FROM jbp_user_prop WHERE jbp_name = "portal.user.security.question" AND jbp_uid = n.pn_uid);
+
+-- Inserting a "dummy" user which will be the poster of posts, topics with no poster.
+-- Nobody can log in as that user because his password is illegal - not a md5 hash.
+INSERT INTO jbp_users (jbp_uname, jbp_password, jbp_regdate, jbp_realemail, jbp_fakeemail, 
+	jbp_viewrealemail, jbp_enabled) VALUES
+	('Past user', 'A text that is not an md5 hash.', now(), 'no-email', 'no-email',
+		0, 1);
+
+SET @dummy_user_id = (SELECT u.jbp_uid FROM jbp_users u WHERE u.jbp_uname = 'Past user');
+
+INSERT INTO jbp_forums_posters (jbp_id, jbp_user_id, jbp_post_count)
+	VALUES (@dummy_user_id, @dummy_user_id, 0);
+
+INSERT INTO jbp_role_membership (jbp_rid, jbp_uid) VALUES
+	(2, @dummy_user_id);

Added: labs/jbosslabs/trunk/portal-extensions/forge-forums/scripts/toPortal26/new/migration-fix.sql
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-forums/scripts/toPortal26/new/migration-fix.sql	                        (rev 0)
+++ labs/jbosslabs/trunk/portal-extensions/forge-forums/scripts/toPortal26/new/migration-fix.sql	2007-07-09 22:21:23 UTC (rev 13278)
@@ -0,0 +1,42 @@
+-- Hibernate doesn't like null-like dates.
+UPDATE jbp_forums_posts SET jbp_create_date='1970-01-01 00:00:00' WHERE jbp_create_date='0000-00-00 00:00:00';
+
+UPDATE jbp_forums_posts SET jbp_edit_date='1970-01-01 00:00:00' WHERE jbp_edit_date='0000-00-00 00:00:00';
+
+UPDATE jbp_forums_topics SET jbp_last_post_date='1970-01-01 00:00:00' WHERE jbp_last_post_date='0000-00-00 00:00:00';
+
+-- Portal doesn't like "null" here.
+UPDATE jbp_forums_forums SET jbp_prune_next=0 WHERE jbp_prune_next IS NULL;
+
+-- Deleting forums with no category.
+DELETE FROM jbp_forums_forums WHERE jbp_category_id IS NULL;
+
+-- Deleting topics with no forum.
+DELETE FROM jbp_forums_topics WHERE jbp_forum_id IS NULL;
+
+-- Deleting posts with no topic.
+DELETE FROM jbp_forums_posts WHERE jbp_topic_id IS NULL;
+
+-- There are misterious topics which have jbp_last_post_date from the future
+-- So, we need to estimate those dates once more
+update jbp_forums_topics t SET jbp_last_post_date=(
+	select MAX(p.jbp_create_date)
+	from jbp_forums_posts p
+	where p.jbp_topic_id=t.jbp_id
+	group by p.jbp_topic_id
+)
+where t.jbp_last_post_date > DATE('2007-01-25 00:00:00');
+
+SET @dummy_user_id = (SELECT u.jbp_uid FROM jbp_users u WHERE u.jbp_uname = 'Past user');
+
+-- Updating posts that have been posted by a null user to be posted by the dummy user just
+-- created.
+UPDATE jbp_forums_posts SET jbp_poster_id = @dummy_user_id WHERE jbp_poster_id IS NULL;
+
+-- Updating topics that have been created by a null user to be created by the dummy user.
+UPDATE jbp_forums_topics SET jbp_poster = @dummy_user_id WHERE jbp_poster IS NULL;
+
+-- Updating post count
+UPDATE jbp_forums_posters posters SET posters.jbp_post_count = (SELECT COUNT(posts.jbp_id) 
+FROM jbp_forums_posts posts WHERE posts.jbp_poster_id = posters.jbp_id);
+

Added: labs/jbosslabs/trunk/portal-extensions/forge-forums/scripts/toPortal26/new/migration-forum.sql
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-forums/scripts/toPortal26/new/migration-forum.sql	                        (rev 0)
+++ labs/jbosslabs/trunk/portal-extensions/forge-forums/scripts/toPortal26/new/migration-forum.sql	2007-07-09 22:21:23 UTC (rev 13278)
@@ -0,0 +1,126 @@
+
+-- Copying data from forums.
+INSERT INTO jbp_forums_forums (jbp_id, jbp_category_id, jbp_description,
+		jbp_name, jbp_order, jbp_topic_count,
+		jbp_post_count, jbp_prune_enable, jbp_prune_next,
+		jbp_status)
+	SELECT n.forum_id, n.cat_id, n.forum_desc,
+		n.forum_name, n.forum_order, n.forum_topics, 
+		n.forum_posts, n.prune_enable, n.prune_next,
+		n.forum_status FROM phpbb_forums n 
+		WHERE n.forum_id = @forumId;
+
+-- Copying data from forumswatch - two tables required here.
+DROP TABLE IF EXISTS `tmp_jbp_forums_forumswatch`;
+CREATE TABLE `tmp_jbp_forums_forumswatch` (
+	`counter` int(11) NOT NULL auto_increment,
+	`jbp_id` int(11) NOT NULL default '0',
+	`jbp_forum_id` int(11) default NULL,
+	`jbp_poster_id` int(11) default NULL,
+	`jbp_mode` int(11) default NULL,
+	PRIMARY KEY (counter)
+) ENGINE=MyISAM;
+
+INSERT INTO tmp_jbp_forums_forumswatch (jbp_forum_id, jbp_poster_id, jbp_mode)
+	SELECT n.forum_id, n.user_id, n.watch_mode
+	FROM phpbb_forums_watch n
+	WHERE n.forum_id = @forumId;
+
+UPDATE tmp_jbp_forums_forumswatch SET jbp_id = (SELECT IFNULL(MAX(p.jbp_id), 0) FROM jbp_forums_watch p) + counter;
+
+-- First inserting user+mode data.
+INSERT INTO jbp_forums_watch (jbp_id, jbp_poster_id, jbp_mode)
+	SELECT t.jbp_id, t.jbp_poster_id, t.jbp_mode FROM tmp_jbp_forums_forumswatch t;
+
+-- Now inserting the actual watches.
+INSERT INTO jbp_forums_forumswatch (jbp_id, jbp_forum_id)
+	SELECT t.jbp_id, t.jbp_forum_id FROM tmp_jbp_forums_forumswatch t;
+	
+DROP TABLE IF EXISTS `tmp_jbp_forums_forumswatch`;
+
+-- Copying topics.
+INSERT INTO jbp_forums_topics (jbp_id, jbp_forum_id, jbp_view_count,
+		jbp_replies,
+		jbp_last_post_date, jbp_poster, jbp_type, jbp_status,
+		jbp_subject, jbp_poll)
+	SELECT n.topic_id, n.forum_id, n.topic_views, n.topic_replies,
+		n.topic_last_post_time, n.topic_poster, n.topic_type, 
+		n.topic_status, n.topic_title, NULL FROM phpbb_topics n 
+		WHERE n.forum_id = @forumId;
+
+-- Copying posts.
+INSERT INTO jbp_forums_posts (jbp_id, jbp_topic_id, jbp_edit_count,
+		jbp_edit_date, jbp_create_date, jbp_subject, jbp_text,
+		jbp_poster_id)
+	SELECT n.post_id, n.topic_id, n.post_edit_count, n.post_edit_time,
+		n.post_time, n.post_subject, n.post_text,
+		n.poster_id FROM phpbb_posts n 
+		WHERE n.forum_id = @forumId;
+
+-- Copying pools
+INSERT INTO jbp_forums_polls (jbp_poll_id, jbp_title, jbp_length, jbp_creation_date)
+	SELECT n.vote_id, n.vote_text, n.vote_length, date(concat(n.vote_start, '-01-01'))
+		FROM phpbb_vote_desc n
+		JOIN jbp_forums_topics p ON
+			p.jbp_id = n.topic_id WHERE p.jbp_forum_id = @forumId;
+
+UPDATE jbp_forums_topics SET jbp_poll = 
+	(SELECT n.vote_id FROM phpbb_vote_desc n WHERE n.topic_id = jbp_id)
+	WHERE (SELECT COUNT(*) FROM phpbb_vote_desc n WHERE n.topic_id = jbp_id) = 1 AND jbp_forum_id = @forumId;
+
+-- Copying pool options
+DROP TABLE IF EXISTS `tmp_forums_poll_option`;
+CREATE TABLE `tmp_forums_poll_option` (
+	`counter` int(11) NOT NULL auto_increment,
+	`jbp_poll_id` int(11) NOT NULL default '0',
+	`jbp_votes` int(11) NOT NULL default '0',
+	`jbp_question` varchar(255) NOT NULL default '',
+	`jbp_poll_option_position` int(11) NOT NULL default '0',
+	PRIMARY KEY  (counter)
+) ENGINE=MyISAM;
+
+INSERT INTO tmp_forums_poll_option (jbp_poll_id, jbp_votes, jbp_question, jbp_poll_option_position) 
+	SELECT n.vote_desc_id, n.vote_result, n.vote_option_text, 0 FROM phpbb_vote_results n 
+		WHERE n.vote_desc_id IN 
+			(SELECT jbp_poll FROM jbp_forums_topics WHERE jbp_forum_id = @forumId AND jbp_poll IS NOT NULL)
+		ORDER BY n.vote_desc_id;
+
+INSERT INTO jbp_forums_poll_option (jbp_poll_id, jbp_votes, jbp_question, jbp_poll_option_position) 
+	SELECT t.jbp_poll_id, t.jbp_votes, t.jbp_question,  t.counter - (SELECT MIN(counter) FROM tmp_forums_poll_option WHERE jbp_poll_id = t.jbp_poll_id) FROM tmp_forums_poll_option t;
+
+DROP TABLE IF EXISTS `tmp_forums_poll_option`;
+
+INSERT INTO jbp_forums_poll_voted (jbp_poll_id, jbp_poll_voted)
+	SELECT n.vote_desc_id, n.vote_user_id
+		FROM phpbb_vote_voters n
+		JOIN phpbb_vote_desc n2 ON
+			n2.vote_id = n.vote_desc_id
+		JOIN jbp_forums_topics p ON
+			p.jbp_id = n2.topic_id WHERE p.jbp_forum_id = @forumId;
+
+-- Copying topics watch
+DROP TABLE IF EXISTS `tmp_jbp_forums_topicswatch`;
+CREATE TABLE `tmp_jbp_forums_topicswatch` (
+	`counter` int(11) NOT NULL auto_increment,
+	`jbp_id` int(11) NOT NULL default '0',
+	`jbp_topic_id` int(11) default NULL,
+	`jbp_poster_id` int(11) default NULL,
+	`jbp_mode` int(11) default NULL,
+	PRIMARY KEY (counter)
+) ENGINE=MyISAM;
+
+INSERT INTO tmp_jbp_forums_topicswatch (jbp_topic_id, jbp_poster_id, jbp_mode)
+	SELECT n.topic_id, n.user_id, n.notify_status
+	FROM phpbb_topics_watch n
+	JOIN jbp_forums_topics p ON
+		p.jbp_id = n.topic_id WHERE p.jbp_forum_id = @forumId;
+
+UPDATE tmp_jbp_forums_topicswatch SET jbp_id = (SELECT IFNULL(MAX(p.jbp_id), 0) FROM jbp_forums_watch p) + counter;
+
+INSERT INTO jbp_forums_watch (jbp_id, jbp_poster_id, jbp_mode)
+	SELECT t.jbp_id, t.jbp_poster_id, t.jbp_mode FROM tmp_jbp_forums_topicswatch t;
+
+INSERT INTO jbp_forums_topicswatch (jbp_id, jbp_topic_id)
+	SELECT t.jbp_id, t.jbp_topic_id FROM tmp_jbp_forums_topicswatch t;
+	
+DROP TABLE IF EXISTS `tmp_jbp_forums_topicswatch`;
\ No newline at end of file

Added: labs/jbosslabs/trunk/portal-extensions/forge-forums/scripts/toPortal26/new/migration-portal-keys.sql
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-forums/scripts/toPortal26/new/migration-portal-keys.sql	                        (rev 0)
+++ labs/jbosslabs/trunk/portal-extensions/forge-forums/scripts/toPortal26/new/migration-portal-keys.sql	2007-07-09 22:21:23 UTC (rev 13278)
@@ -0,0 +1,112 @@
+-- ADDING KEYS AND INDEXES TO EXISITING PORTAL TABLES - AFTER A DATA IMPORT
+
+--
+-- Table structure for table `jbp_forums_categories`
+--
+
+ALTER TABLE jbp_forums_categories 
+	MODIFY jbp_id int(11) NOT NULL auto_increment,
+	ADD PRIMARY KEY  (jbp_id);
+
+--
+-- Table structure for table `jbp_forums_forums`
+--
+
+ALTER TABLE jbp_forums_forums MODIFY jbp_id int(11) NOT NULL auto_increment,
+	ADD PRIMARY KEY  (jbp_id),
+	ADD INDEX (jbp_category_id),
+	ADD FOREIGN KEY (jbp_category_id) REFERENCES jbp_forums_categories (jbp_id);
+
+--
+-- Table structure for table `jbp_forums_forumswatch`
+--
+
+ALTER TABLE jbp_forums_forumswatch
+	ADD PRIMARY KEY (jbp_id),
+	ADD INDEX (jbp_forum_id),
+	ADD FOREIGN KEY (jbp_forum_id) REFERENCES jbp_forums_forums (jbp_id),
+	ADD FOREIGN KEY (jbp_id) REFERENCES jbp_forums_watch (jbp_id);
+
+--
+-- Table structure for table `jbp_forums_poll_option`
+--
+
+ALTER TABLE jbp_forums_poll_option
+	ADD PRIMARY KEY  (jbp_poll_id, jbp_poll_option_position),
+	ADD INDEX (jbp_poll_id),
+	ADD FOREIGN KEY (jbp_poll_id) REFERENCES jbp_forums_polls (jbp_id);
+
+--
+-- Table structure for table `jbp_forums_poll_voted`
+--
+
+ALTER TABLE jbp_forums_poll_voted
+	ADD PRIMARY KEY  (jbp_poll_id, jbp_poll_voted),
+	ADD INDEX (jbp_poll_id),
+	ADD FOREIGN KEY (jbp_poll_id) REFERENCES jbp_forums_polls (jbp_id);
+
+--
+-- Table structure for table `jbp_forums_polls`
+--
+
+ALTER TABLE jbp_forums_polls
+	MODIFY jbp_poll_id int(11) NOT NULL auto_increment,
+	ADD PRIMARY KEY (jbp_poll_id);
+
+--
+-- Table structure for table `jbp_forums_posters`
+--
+
+ALTER TABLE jbp_forums_posters 
+	MODIFY jbp_id int(11) NOT NULL auto_increment,
+	ADD PRIMARY KEY (jbp_id),
+	ADD UNIQUE (jbp_user_id);
+
+--
+-- Table structure for table `jbp_forums_posts`
+--
+
+ALTER TABLE jbp_forums_posts
+	MODIFY jbp_id int(11) NOT NULL auto_increment,
+	ADD PRIMARY KEY (jbp_id),
+	ADD INDEX (jbp_topic_id),
+	ADD INDEX (jbp_poster_id),
+	ADD FOREIGN KEY (jbp_topic_id) REFERENCES jbp_forums_topics (jbp_id),
+	ADD FOREIGN KEY (jbp_poster_id) REFERENCES jbp_forums_posters (jbp_id),
+	ADD INDEX (jbp_create_date);
+
+--
+-- Table structure for table `jbp_forums_topics`
+--
+
+ALTER TABLE jbp_forums_topics
+	MODIFY jbp_id int(11) NOT NULL auto_increment,
+	ADD PRIMARY KEY (jbp_id),
+	ADD INDEX (jbp_forum_id),
+	ADD INDEX (jbp_poll),
+	ADD INDEX (jbp_poster),
+	ADD FOREIGN KEY (jbp_forum_id) REFERENCES jbp_forums_forums (jbp_id),
+	ADD FOREIGN KEY (jbp_poll) REFERENCES jbp_forums_polls (jbp_id),
+	ADD FOREIGN KEY (jbp_poster) REFERENCES jbp_forums_posters (jbp_id);
+
+--
+-- Table structure for table `jbp_forums_topicswatch`
+--
+
+ALTER TABLE jbp_forums_topicswatch
+	ADD INDEX (jbp_id),
+	ADD INDEX (jbp_topic_id),
+	ADD FOREIGN KEY (jbp_id) REFERENCES jbp_forums_posters (jbp_id),
+	ADD FOREIGN KEY (jbp_topic_id) REFERENCES jbp_forums_topics (jbp_id);
+
+--
+-- Table structure for table `jbp_forums_watch`
+--
+
+ALTER TABLE jbp_forums_watch
+	MODIFY jbp_id int(11) NOT NULL auto_increment,
+	ADD PRIMARY KEY (jbp_id),
+	ADD INDEX (jbp_poster_id),
+	ADD FOREIGN KEY (jbp_poster_id) REFERENCES jbp_forums_posters (jbp_id);
+
+-- REST OF THE TABLES ALREADY HAVE KEY INFO.

Added: labs/jbosslabs/trunk/portal-extensions/forge-forums/scripts/toPortal26/new/migration-portal-pure.sql
===================================================================
--- labs/jbosslabs/trunk/portal-extensions/forge-forums/scripts/toPortal26/new/migration-portal-pure.sql	                        (rev 0)
+++ labs/jbosslabs/trunk/portal-extensions/forge-forums/scripts/toPortal26/new/migration-portal-pure.sql	2007-07-09 22:21:23 UTC (rev 13278)
@@ -0,0 +1,204 @@
+-- PORTAL DB STRUCTURE WITHOUT KEY INFORMATION (FOR A PAINLESS DATA IMPORT)
+
+--
+-- Table structure for table `jbp_forums_categories`
+--
+
+--DROP TABLE IF EXISTS `jbp_forums_categories`;
+CREATE TABLE IF NOT EXISTS `jbp_forums_categories` (
+  `jbp_id` int(11) NOT NULL,
+  `jbp_order` int(11) default NULL,
+  `jbp_title` varchar(255) default NULL
+) ENGINE=MyISAM; -- DEFAULT CHARSET=latin1;
+
+--
+-- Table structure for table `jbp_forums_forums`
+--
+
+--DROP TABLE IF EXISTS `jbp_forums_forums`;
+CREATE TABLE IF NOT EXISTS `jbp_forums_forums` (
+  `jbp_id` int(11) NOT NULL,
+  `jbp_category_id` int(11) default NULL,
+  `jbp_description` varchar(255) default NULL,
+  `jbp_name` varchar(255) default NULL,
+  `jbp_order` int(11) default NULL,
+  `jbp_topic_count` int(11) default NULL,
+  `jbp_post_count` int(11) default NULL,
+  `jbp_prune_enable` tinyint(1) default NULL,
+  `jbp_prune_next` int(11) default NULL,
+  `jbp_status` int(11) default NULL
+) ENGINE=MyISAM; -- DEFAULT CHARSET=latin1;
+
+--
+-- Table structure for table `jbp_forums_forumswatch`
+--
+
+--DROP TABLE IF EXISTS `jbp_forums_forumswatch`;
+CREATE TABLE IF NOT EXISTS `jbp_forums_forumswatch` (
+  `jbp_id` int(11) NOT NULL default '0',
+  `jbp_forum_id` int(11) default NULL
+) ENGINE=MyISAM; -- DEFAULT CHARSET=latin1;
+
+--
+-- Table structure for table `jbp_forums_poll_option`
+--
+
+--DROP TABLE IF EXISTS `jbp_forums_poll_option`;
+CREATE TABLE IF NOT EXISTS `jbp_forums_poll_option` (
+  `jbp_poll_id` int(11) NOT NULL default '0',
+  `jbp_votes` int(11) NOT NULL default '0',
+  `jbp_question` varchar(255) NOT NULL default '',
+  `jbp_poll_option_position` int(11) NOT NULL default '0'
+) ENGINE=MyISAM; -- DEFAULT CHARSET=latin1;
+
+--
+-- Table structure for table `jbp_forums_poll_voted`
+--
+
+--DROP TABLE IF EXISTS `jbp_forums_poll_voted`;
+CREATE TABLE IF NOT EXISTS `jbp_forums_poll_voted` (
+  `jbp_poll_id` int(11) NOT NULL default '0',
+  `jbp_poll_voted` int(11) NOT NULL default '0'
+) ENGINE=MyISAM; -- DEFAULT CHARSET=latin1;
+
+
+--
+-- Table structure for table `jbp_forums_polls`
+--
+
+--DROP TABLE IF EXISTS `jbp_forums_polls`;
+CREATE TABLE IF NOT EXISTS `jbp_forums_polls` (
+  `jbp_poll_id` int(11) NOT NULL,
+  `jbp_title` varchar(255) default NULL,
+  `jbp_length` int(11) default NULL,
+  `jbp_creation_date` datetime NOT NULL default '0000-00-00 00:00:00'
+) ENGINE=MyISAM; -- DEFAULT CHARSET=latin1;
+
+--
+-- Table structure for table `jbp_forums_posters`
+--
+
+--DROP TABLE IF EXISTS `jbp_forums_posters`;
+CREATE TABLE IF NOT EXISTS `jbp_forums_posters` (
+  `jbp_id` int(11) NOT NULL,
+  `jbp_user_id` varchar(255) default NULL,
+  `jbp_post_count` int(11) default NULL
+) ENGINE=MyISAM; -- DEFAULT CHARSET=latin1;
+
+--
+-- Table structure for table `jbp_forums_posts`
+--
+
+--DROP TABLE IF EXISTS `jbp_forums_posts`;
+CREATE TABLE IF NOT EXISTS `jbp_forums_posts` (
+  `jbp_id` int(11) NOT NULL,
+  `jbp_topic_id` int(11) default NULL,
+  `jbp_edit_count` int(11) default NULL,
+  `jbp_edit_date` datetime default NULL,
+  `jbp_create_date` datetime default NULL,
+  `jbp_subject` varchar(255) default NULL,
+  `jbp_text` text,
+  `jbp_poster_id` int(11) default NULL
+) ENGINE=MyISAM; -- DEFAULT CHARSET=latin1;
+
+--
+-- Table structure for table `jbp_forums_topics`
+--
+
+--DROP TABLE IF EXISTS `jbp_forums_topics`;
+CREATE TABLE IF NOT EXISTS `jbp_forums_topics` (
+  `jbp_id` int(11) NOT NULL,
+  `jbp_forum_id` int(11) default NULL,
+  `jbp_view_count` int(11) default NULL,
+  `jbp_replies` int(11) default NULL,
+  `jbp_last_post_date` datetime default NULL,
+  `jbp_poster` int(11) default NULL,
+  `jbp_type` int(11) default NULL,
+  `jbp_status` int(11) default NULL,
+  `jbp_subject` varchar(255) default NULL,
+  `jbp_poll` int(11) default NULL
+) ENGINE=MyISAM; -- DEFAULT CHARSET=latin1;
+
+--
+-- Table structure for table `jbp_forums_topicswatch`
+--
+
+--DROP TABLE IF EXISTS `jbp_forums_topicswatch`;
+CREATE TABLE IF NOT EXISTS `jbp_forums_topicswatch` (
+  `jbp_id` int(11) NOT NULL default '0',
+  `jbp_topic_id` int(11) default NULL
+) ENGINE=MyISAM; -- DEFAULT CHARSET=latin1;
+
+--
+-- Table structure for table `jbp_forums_watch`
+--
+
+--DROP TABLE IF EXISTS `jbp_forums_watch`;
+CREATE TABLE IF NOT EXISTS `jbp_forums_watch` (
+  `jbp_id` int(11) NOT NULL,
+  `jbp_poster_id` int(11) default NULL,
+  `jbp_mode` int(11) default NULL
+) ENGINE=MyISAM; -- DEFAULT CHARSET=latin1;
+
+-- FROM NOW ON, KEY INFORMATION IS PRESENT - IT DOES NOT CONFILCT WITH DATA
+-- IMPORT.
+
+--
+-- Table structure for table `jbp_role_membership`
+--
+
+--DROP TABLE IF EXISTS `jbp_role_membership`;
+CREATE TABLE IF NOT EXISTS `jbp_role_membership` (
+  `jbp_uid` bigint(20) NOT NULL default '0',
+  `jbp_rid` bigint(20) NOT NULL default '0',
+  PRIMARY KEY  (`jbp_uid`,`jbp_rid`),
+  KEY `FKF4101738E70E4BD7` (`jbp_uid`),
+  KEY `FKF4101738A7430374` (`jbp_rid`)
+) ENGINE=MyISAM; -- DEFAULT CHARSET=latin1;
+
+--
+-- Table structure for table `jbp_roles`
+--
+
+--DROP TABLE IF EXISTS `jbp_roles`;
+CREATE TABLE IF NOT EXISTS `jbp_roles` (
+  `jbp_rid` bigint(20) NOT NULL auto_increment,
+  `jbp_name` varchar(255) default NULL,
+  `jbp_displayname` varchar(255) default NULL,
+  PRIMARY KEY  (`jbp_rid`),
+  UNIQUE KEY `jbp_name` (`jbp_name`),
+  UNIQUE KEY `jbp_displayname` (`jbp_displayname`)
+) ENGINE=MyISAM; -- DEFAULT CHARSET=latin1;
+
+--
+-- Table structure for table `jbp_user_prop`
+--
+
+--DROP TABLE IF EXISTS `jbp_user_prop`;
+CREATE TABLE IF NOT EXISTS `jbp_user_prop` (
+  `jbp_uid` bigint(20) NOT NULL default '0',
+  `jbp_value` varchar(255) default NULL,
+  `jbp_name` varchar(255) NOT NULL default '',
+  PRIMARY KEY  (`jbp_uid`,`jbp_name`),
+  KEY `FK93CC4610E70E4BD7` (`jbp_uid`)
+) ENGINE=MyISAM; -- DEFAULT CHARSET=latin1;
+
+--
+-- Table structure for table `jbp_users`
+--
+
+--DROP TABLE IF EXISTS `jbp_users`;
+CREATE TABLE IF NOT EXISTS `jbp_users` (
+  `jbp_uid` bigint(20) NOT NULL auto_increment,
+  `jbp_uname` varchar(255) default NULL,
+  `jbp_givenname` varchar(255) default NULL,
+  `jbp_familyname` varchar(255) default NULL,
+  `jbp_password` varchar(255) default NULL,
+  `jbp_realemail` varchar(255) default NULL,
+  `jbp_fakeemail` varchar(255) default NULL,
+  `jbp_regdate` datetime default NULL,
+  `jbp_viewrealemail` tinyint(1) default NULL,
+  `jbp_enabled` tinyint(1) default NULL,
+  PRIMARY KEY  (`jbp_uid`),
+  UNIQUE KEY `jbp_uname` (`jbp_uname`)
+) ENGINE=MyISAM; -- DEFAULT CHARSET=latin1;




More information about the jboss-svn-commits mailing list