-- =========================================================================
-- SCRIPT RAPIDE : Nettoyage complet et immédiat
-- =========================================================================
-- À utiliser seulement après avoir vérifié avec cleanup_all_progress.sql
-- =========================================================================

START TRANSACTION;

-- Suppression dans le bon ordre (dépendances)
DELETE FROM v2_student_assessment_answers;
DELETE FROM v2_student_assessments;
DELETE FROM v2_student_seance_progress;
DELETE FROM v2_student_sessions;
DELETE FROM v2_student_quiz_assignments;
DELETE FROM v2_enrollments;

-- Réinitialiser les compteurs
UPDATE v2_formations SET student_count = 0;


-- ⚠️ Choisir l'une des deux lignes suivantes :
COMMIT;   -- Pour VALIDER les suppressions
-- ROLLBACK; -- Pour ANNULER les suppressions

-- Vérification finale
SELECT 
    'Nettoyage terminé !' as status,
    (SELECT COUNT(*) FROM v2_enrollments) as enrollments,
    (SELECT COUNT(*) FROM v2_student_seance_progress) as progress,
    (SELECT COUNT(*) FROM v2_student_assessments) as assessments,
    (SELECT COUNT(*) FROM v2_students) as students_preserved,
    (SELECT COUNT(*) FROM v2_formations) as formations_preserved;
