
-- Add UNIQUE constraint to prevent same BIB in same heat within an event
ALTER TABLE event_participants
DROP INDEX IF EXISTS unique_assignment;

ALTER TABLE event_participants
ADD UNIQUE KEY unique_assignment (event_id, heat_number, participant_id);

-- Also ensure that participants.bib is unique
ALTER TABLE participants
ADD UNIQUE KEY unique_bib (bib);
