Solving problems the simple/wrong way ?

Started by GoLaserEyes, April 13, 2008, 07:05:31 AM

Previous topic - Next topic

GoLaserEyes

Hey,

I just tried to convert my old phpBB2 tables to SMF. I had a lot of trouble with the tables (duplicate entries en masse) which prevented either BigDump to migrate my data from the old webspace to the new one and later on after I just desperately wiped the whole wordmatch table from the dump the converter.php threw a lot of duplicate errors at me.

Now I knew that these duplicate entries arise only when parts of the table are flagged "unique" which in return let me to the conclusion that for the converting process, I could maybe disable every "unique" flag in the table in question (the smf_topics in this case). So I did, the converting process was a sucess and the forum seems to work perfectly so far. No topics linked wrong or anything.

Problem: After converting, SQL refused to flag the proper colums unique again as I tried to (for the obvious reason that I just converted the duplicate entries in my new table).

Question: If I decide to keep unique being turned off in that table, is there a chance that my forum will go to hell in time ? What about further backups of the tables ? If I keep backing up my data with this modified table, may that corrupt the backup files ?

Regards,

- GoLa

SleePy

It is possible you might run into issues.

We can try to find any of these duplicated IDs and remove them though. One of the IDs is not even being used at all so it could be removed.

I am going to show an example so hopefully you can copy and edit as needed for other tables.
For instance lets say you have duplicate ids in your topics table.

Using phpMyAdmin go to your topics table and then structure.
Add a new column called temp that is a varchar of 255. Everything else is left the same

Then go to the sql tab and run this query:
UPDATE smf_topics
SET temp = RAND()
WHERE ID_TOPIC != 0


This will put a random field integer in each of the temp columns for every topic. This may take a while if you got a lot of posts.

Then run the below query:

SELECT *
FROM `smf_topics` as a
LEFT JOIN `smf_topics` as b ON (a.ID_TOPIC = b.ID_TOPIC_
WHERE a.temp != b.temp


This will output all duplicate topic IDS that you are getting.

The harder part is looking at the id_messages and such to determine what topics you do not want or think are not being used.
Jeremy D ~ Site Team / SMF Developer ~ GitHub Profile ~ Join us on IRC @ Libera.chat/#smf ~ Support the SMF Support team!

Advertisement: