-- Super Sunday Seed (tournoi + joueurs)
BEGIN;

INSERT INTO tournaments (name, location, start_date, end_date)
VALUES ('Super Sunday Demo', 'Padel Club', CURRENT_DATE, CURRENT_DATE)
ON CONFLICT DO NOTHING;

-- Récupère l'id du tournoi inséré / existant
WITH t AS (
  SELECT id FROM tournaments WHERE name='Super Sunday Demo' ORDER BY id DESC LIMIT 1
)
INSERT INTO participants (tournament_id, full_name)
SELECT t.id, p.full_name
FROM t
JOIN (VALUES
  ('Alex Dupont'),('Samira El Idrissi'),('Marco Rossi'),('Lina Gomez'),
  ('Yuki Tanaka'),('Nina Kowalski'),('Oliver Smith'),('Fatou Ndiaye')
) AS p(full_name) ON TRUE
ON CONFLICT DO NOTHING;

COMMIT;
