-- Dodanie kolumn dla śledzenia kolejnych poprawnych/błędnych odpowiedzi

-- Sprawdź czy kolumny już istnieją
SELECT COUNT(*) as consecutive_correct_exists
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_SCHEMA = 'edu_app'
AND TABLE_NAME = 'progress'
AND COLUMN_NAME = 'consecutive_correct';

SELECT COUNT(*) as consecutive_errors_exists
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_SCHEMA = 'edu_app'
AND TABLE_NAME = 'progress'
AND COLUMN_NAME = 'consecutive_errors';

-- Dodaj kolumnę consecutive_correct jeśli nie istnieje
ALTER TABLE progress
ADD COLUMN IF NOT EXISTS consecutive_correct INT DEFAULT 0 AFTER completed_exercises;

-- Dodaj kolumnę consecutive_errors jeśli nie istnieje
ALTER TABLE progress
ADD COLUMN IF NOT EXISTS consecutive_errors INT DEFAULT 0 AFTER consecutive_correct;