News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

2.0.0 Topic Problem

Started by figwad, December 01, 2007, 02:44:40 AM

Previous topic - Next topic

figwad

Hi.  I have a question in regard to the IPB 2.0.0 converter found in the pinned topic.  It gave some errors, but everything important seems to be in place (posts, members, boards, etc.) besides one problem: it didn't convert all the topics.  That is, all the posts are there (over 300,000, verified in phpmyadmin) and could be viewed if the topics themselves existed.  However, only 500 of the roughly 30,000 topics were converted, so many of the posts simply cannot be viewed. 


I've tried converting with a query, but have had little success (duplicate entry error, '#1062 - Duplicate entry '0-8' for key 3' to be exact) when I try:


INSERT INTO smf_topics (ID_TOPIC,ID_FIRST_MSG,ID_LAST_MSG,locked,ID_POLL,isSticky,ID_BOARD,ID_MEMBER_STARTED,ID_MEMBER_UPDATED,numReplies,numViews)
SELECT
t.tid AS ID_TOPIC, t.pinned AS isSticky, t.forum_id AS ID_BOARD,
t.starter_id AS ID_MEMBER_STARTED, t.last_poster_id AS ID_MEMBER_UPDATED,
pl.pid AS ID_POLL, t.posts AS numReplies, t.views AS numViews,
MIN(p.pid) AS ID_FIRST_MSG, MAX(p.pid) AS ID_LAST_MSG,
t.state = 'closed' AS locked
FROM (ibf_topics AS t, ibf_posts AS p)
LEFT JOIN ibf_polls AS pl ON (pl.tid = t.tid)
WHERE p.topic_id = t.tid
GROUP BY t.tid
HAVING ID_FIRST_MSG != 0
AND ID_LAST_MSG != 0;


Without the insert, the data looks correct, but I believe the restrictions on the fields do not allow me to insert them. My friend and I have a hunch it may be because of moved topics that are moved with a link in the source forum.  Maybe not.

If someone could show me how I would insert the data properly, another way to retrieve the topics, or any information on why the initial conversion stopped at 500, it would be greatly appreciated.  I assume I would also need help with the following steps in converting polls properly.



Thanks for your time.

SleePy

Is that the exact error?
There is a duplicate key error but it doesn't tell me from which table it is coming from tolook at the indexes.
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

figwad

#2
That's the exact error.


Quote
SQL query:
INSERT INTO smf_topics( ID_TOPIC, ID_FIRST_MSG, ID_LAST_MSG, locked, ID_POLL, isSticky, ID_BOARD, ID_MEMBER_STARTED, ID_MEMBER_UPDATED, numReplies, numViews )
SELECT t.tid AS ID_TOPIC, t.pinned AS isSticky, hxxp:t.forum [nonactive]_id AS ID_BOARD, t.starter_id AS ID_MEMBER_STARTED, t.last_poster_id AS ID_MEMBER_UPDATED, hxxp:pl.pid [nonactive] AS ID_POLL, t.posts AS numReplies, t.views AS numViews, MIN( hxxp:p.pid [nonactive] ) AS ID_FIRST_MSG, MAX( hxxp:p.pid [nonactive] ) AS ID_LAST_MSG, t.state = 'closed' AS locked
FROM (
ibf_topics AS t, ibf_posts AS p
)
LEFT JOIN ibf_polls AS pl ON ( pl.tid = t.tid )
WHERE p.topic_id = t.tid
GROUP BY t.tid
HAVING ID_FIRST_MSG !=0
AND ID_LAST_MSG !=0

MySQL said:
#1062 - Duplicate entry '0-8' for key 3

Is there anything I can do to retrieve the required information to receive help?

SleePy

Seems ID_FIRST_MSG is set to 0 or empty...
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

figwad

#4
Not according to a query selecting where ID_FIRST_MSG is 0 (also since the select without insert returns all the data).  I think it's ID_FIRST_MSG and ID_LAST_MSG not having a unique value (and not 0).  Is there a way to check where those to fields are not unique and in which topic id?


Is it possible that I'm inserting the data wrong? When I remove the unique restrictions from those two fields and insert with the same query, all the data ends up in the wrong fields.  If I alter these tables to be correct and leave the unique restriction removed, will there be a problem?

Advertisement: