
-- Delete duplicate records
DELETE FROM was_event_participant
WHERE event_participant_id NOT IN
(
  SELECT MAX(ep.event_participant_id) AS max_id
  FROM (SELECT * FROM was_event_participant) AS ep
  GROUP BY ep.event_id, ep.user_id
);

-- Drop indexes & add unique index:
ALTER TABLE was_event_participant
DROP INDEX event_id,
DROP INDEX user_id,
ADD UNIQUE unq_event_user (event_id, user_id);