-- 202_attempts_selected_choice_nullable.sql (3/6)
-- selected_choice NULL 허용 + CHECK 재정의 (NULL 또는 1~4).
-- "unsure" 케이스에서 사용자가 답을 선택 안 함 → NULL.
--
-- ALTER 여러 개 콤마 분리 = 1 statement (asyncpg exec_driver_sql 호환).

ALTER TABLE study_question_attempts
    DROP CONSTRAINT IF EXISTS study_question_attempts_selected_choice_check,
    ALTER COLUMN selected_choice DROP NOT NULL,
    ADD CONSTRAINT study_question_attempts_selected_choice_check
        CHECK (selected_choice IS NULL OR (selected_choice BETWEEN 1 AND 4));
