-- Ensure PerformanceParticipation unique index allows one base row and one training row per performance/track
-- Drop legacy unique index if it exists
DROP INDEX IF EXISTS "PerformanceParticipation_performanceId_bandTrackId_key";

-- Create the new composite unique index including isTrainingRow
CREATE UNIQUE INDEX IF NOT EXISTS "PerformanceParticipation_performanceId_bandTrackId_isTrainingRow_key"
ON "PerformanceParticipation" ("performanceId", "bandTrackId", "isTrainingRow");
