CREATE TABLE IF NOT EXISTS `competition_participants` (
  `id` INT AUTO_INCREMENT PRIMARY KEY,
  `user_id` INT NOT NULL,
  `competition_id` INT NOT NULL,
  `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
  FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON DELETE CASCADE,
  FOREIGN KEY (`competition_id`) REFERENCES `competitions`(`id`) ON DELETE CASCADE,
  UNIQUE KEY `user_competition` (`user_id`, `competition_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
