Log in

View Full Version : Change Thread ID


SaN-DeeP
03-23-2007, 09:21 PM
I am posting this question here as well. (for faster responses if possible)

How can i change id of a thread, some important threads on one of our forums got deleted accidentally we need to restore them back to there original IDs to preserve our search engine rankings and page ranks.

I am sure this requires database alterations, I am ready for same..

Thank You.

Marco van Herwaarden
03-24-2007, 08:18 AM
I can not really advice changing any id's in the database, as a lot of information is linked across tables using the id's.

But you could try the following (backup first!!!!!):
UPDATE thread SET threadid = <newthreadid> WHERE threadid = <currentid>;
UPDATE post SET threadid = <newthreadid> WHERE threadid = <currentid>;

Never set to a new threadid that is higher then your current highest id!
Also this will break any thread subscriptions etc...

PS Backup first!!!!!!

Use this at your own risk

SaN-DeeP
03-24-2007, 06:52 PM
thank you Marco, but sorry for bump I am unable to understand few words in the query.

newthreadid = new thread we have created in our forums ?
currentid = old thread which was deleted ?

UPDATE post SET threadid = <newthreadid> WHERE threadid = <currentid>;
in above query which requires altering post table does newthreadid means new post number ?
and currentid means deleted post numbers ?

A big thanks for giving me right queries to alter here.

Warm Regards,

Marco van Herwaarden
03-24-2007, 07:08 PM
newthreadid = new thread we have created in our forums ? <-- No newthreadid is the threadid you want it to have, ie the deleted threadid
currentid = old thread which was deleted ? <-- The currentid is the id of the new thread created.

And no, also when updating the post table you should change the threadid, not the postid.

SaN-DeeP
03-24-2007, 07:20 PM
Thank You once again for your quick confirmations, I will post back the results in a short while.

Warm Regards,

SaN-DeeP
03-28-2007, 03:16 AM
Thank You Sir Marco van Herwaarden,
this worked like a charm I was able to restore all my deleted threads back again :)