This is probably belongs in the SQL section, but does anybody have a SQL template (plug in forum numbers and execute) to merge two forums?
Jul 2, 2002, 5:11 PM
Staff / Moderator (2198 posts)
Jul 2, 2002, 5:11 PM
Post #2 of 4
Views: 1750
You can use this query:
UPDATE gforum_Post set forum_id_fk = 123 WHERE forum_id_fk = 456
Replacing 123 with the new forum, and 456 with the old forum. You may get results a little bit screwed up in the forum listings - the latest post information may be wrong; an easy way to fix this is to post into each forum, then delete (full delete - ie. "Remove") those two.
You could do this using Gossamer Forum code (from a global, plugin, new CGI script, etc.) by doing:
$DB->table('Post')->update({ forum_id_fk => 123 } => { forum_id_fk => 456 });
Doing it this way you won't have to worry about the forum display being messed up - but it's more effort since you'll have to put the code somewhere for it to run.
Jason Rhinelander
Gossamer Threads
jason@gossamer-threads.com
UPDATE gforum_Post set forum_id_fk = 123 WHERE forum_id_fk = 456
Replacing 123 with the new forum, and 456 with the old forum. You may get results a little bit screwed up in the forum listings - the latest post information may be wrong; an easy way to fix this is to post into each forum, then delete (full delete - ie. "Remove") those two.
You could do this using Gossamer Forum code (from a global, plugin, new CGI script, etc.) by doing:
$DB->table('Post')->update({ forum_id_fk => 123 } => { forum_id_fk => 456 });
Doing it this way you won't have to worry about the forum display being messed up - but it's more effort since you'll have to put the code somewhere for it to run.
Jason Rhinelander
Gossamer Threads
jason@gossamer-threads.com
Jul 2, 2002, 5:19 PM
Staff / Moderator (2198 posts)
Jul 2, 2002, 5:19 PM
Post #4 of 4
Views: 1754
Alright, the code to do two forums at once would be like this:
UPDATE gforum_Post set forum_id_fk = 123 WHERE forum_id_fk IN (456, 789)
456 and 789 are the two old forum ID's.
Using Gossamer Forum's interface, you would do:
$DB->table('Post')->update({ forum_id_fk => 123 } => { forum_id_fk => [456, 789] });
Jason Rhinelander
Gossamer Threads
jason@gossamer-threads.com
UPDATE gforum_Post set forum_id_fk = 123 WHERE forum_id_fk IN (456, 789)
456 and 789 are the two old forum ID's.
Using Gossamer Forum's interface, you would do:
$DB->table('Post')->update({ forum_id_fk => 123 } => { forum_id_fk => [456, 789] });
Jason Rhinelander
Gossamer Threads
jason@gossamer-threads.com