Titre du sujet : Re: Migration de base punBB vers Xoops 2.3.3 + cbb4 RC et problème de script SQL par Jah sur 28/03/2009 23:03:20
Ça progresse, je n'ai plus qu'une erreur avec juste la fin du script
# Migration text posts
insert into xoops_bb_posts_text (post_id, post_text)
SELECT pun_posts.id, pun_posts.message
FROM pun_topics left join pun_posts on pun_topics.id = pun_posts.topic_id
order by pun_posts.id, pun_posts.topic_id;
qui me cause cette erreur
Erreur
requête SQL: Documentation
INSERT INTO xoops_bb_posts_text( post_id, post_text )
SELECT pun_posts.id, pun_posts.message
FROM pun_topics
LEFT JOIN pun_posts ON pun_topics.id = pun_posts.topic_id
ORDER BY pun_posts.id, pun_posts.topic_id
MySQL a répondu:Documentation
#1062 - Duplicate entry '0' for key 1
La table concernée ayant au préalable vidé bien sur. Si quelqu'un a une idée pour résoudre ce soucis.
Voila le script en entier
# punbb to Xoops 2.0.x CBB 1.15 Converter
# Copyright (C) 2005 Christian EDOM https://www.frxoops.org
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Purpose:
#
# The script was designed to transfer categories, forums, users, and posts
# from Punbb (http://www.punbb.org) to Xoops 2.0.X with Forum CBB 1.15
#
# Assumptions:
#
# - punbb, Xoops and CBB are installed on the same database
# - Xoops and CBB are installed and punbb has contents to transfer
# - Xoops tables are prefixed with "xoops_"
#
# If your table prefixes differ, please do a global search on these prefixes,
# replacing them with the correct prefixes for your installation.
#
# Directions:
#
# This script can be executed using phpMyAdmin or from the command line.
# Using phpMyAdmin, you can first click on the name of your database, then
# scroll down until you see "Run SQL query/queries on database". You can either
# cut and paste this script into this area, or locate this script from your
# home machine by pressing the "Browse:" button and then clicking on "Go."
#
# Notes:
#
# Due to differences in supported functionality between punbb and Forum CBB 1.15,
# some items cannot be converted:
#
# - Polls that accompany topics
# - Topics watch (e-mail alerts when responses are posted)
# - Security by categories and forums
#
# Create users
insert into xoops_users (uid, uname, email, pass, name, url, user_icq, user_msnm, user_aim, user_yim, user_from, user_sig, attachsig, timezone_offset, posts, user_regdate, last_login, actkey, rank, level)
select id, username, email, password, realname, url, icq, msn, aim, yahoo, location, signature, show_sig, timezone, num_posts, registered, last_visit, activate_key, 0,1 from pun_users where id <>1;
# Add users in registred users group
insert into xoops_groups_users_link (groupid, uid)
select 2, uid from xoops_users where uid <>1;
#### Forum CBB 1.15 ####
# Migration categories
insert into xoops_bb_categories (cat_id, cat_title, cat_order)
select id, cat_name, disp_position from pun_categories;
# Migration forums
insert into xoops_bb_forums (forum_id, forum_name, forum_desc, forum_moderator, forum_topics, forum_posts, forum_last_post_id, forum_order, cat_id)
select id, forum_name, forum_desc, moderators, num_topics, num_posts, last_post_id, disp_position, cat_id from pun_forums;
# Migration topics
insert into xoops_bb_topics (topic_id, topic_poster, topic_title, topic_time, topic_last_post_id, poster_name, topic_views, topic_replies, topic_status, topic_sticky, forum_id)
select id, poster, subject, posted, last_post_id, last_poster, num_views, num_replies, closed, sticky, forum_id from pun_topics;
# Migration posts
insert into xoops_bb_posts
(post_id, poster_name, uid, poster_ip, post_time, topic_id, forum_id, subject)
SELECT pun_posts.id, pun_posts.poster, poster_id, INET_ATON(poster_ip), pun_posts.posted, topic_id, forum_id, subject
FROM pun_topics left join pun_posts on pun_topics.id = pun_posts.topic_id
order by pun_posts.id, pun_posts.topic_id;
# Migration text posts
insert into xoops_bb_posts_text (post_id, post_text)
SELECT pun_posts.id, pun_posts.message
FROM pun_topics left join pun_posts on pun_topics.id = pun_posts.topic_id
order by pun_posts.id, pun_posts.topic_id;
|