Duplicates and 'follow_unique' in jrdiscussion_follow_topic
Jamroom Developers
As, to our knowledge, you are the only site using the Discussion module, we actually fixed up your database table 'by hand' as that was a lot quicker and easier than writing repair code for the module (although the module code has been updated to work with the new table schema). Here is what we did -
1) Make a temporary jr_jrdiscussion_follow_topic_tmp table -
CREATE TABLE `jr_jrdiscussion_follow_topic_tmp` (
`follow_topic_id` int(11) unsigned NOT NULL DEFAULT '0',
`follow_user_id` int(11) unsigned NOT NULL DEFAULT '0',
`follow_created` int(11) unsigned NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
2) Copy only the unique values from the existing table to the temporary one -
INSERT INTO jr_jrdiscussion_follow_topic_tmp
SELECT follow_topic_id, follow_user_id, follow_created FROM jr_jrdiscussion_follow_topic GROUP BY follow_topic_id, follow_user_id
3) Make the follow_topic_id and follow_user_id keys as unique
4) Drop the original jr_jrdiscussion_follow_topic table
5) Rename the jr_jrdiscussion_follow_topic_tmp to jr_jrdiscussion_follow_topic