Files
hyungi_document_server/migrations/202_attempts_selected_choice_nullable.sql
Hyungi Ahn d968b2d901 feat(study): 문제풀이 모드 개편 + 결과 분류 + 분야 설명 (PR-9)
- 라벨 "복습 시작" → "문제풀이"
- attempts.outcome 컬럼 + selected_choice nullable (correct/wrong/unsure)
- 풀이 중 정답·해설·AI·비슷한 문제 모두 비노출, 답 클릭 시 자동 진행
- "모르겠음" 5번째 옵션 추가
- 결과 화면 = 정답/틀린/모르겠음 3 카테고리 탭, 카드 클릭 expand
  - 틀린 → PR-3 AI 해설 (RAG)
  - 모르겠음 → 분야(subject+scope) 설명 AI 즉석 생성 + 캐시 (PR-9 신규)
- 분야 설명 RAG: 매핑 documents 청크 + 같은 분야 다른 문제·해설 → bge-reranker
- 마이그레이션 200~205 (single-statement, asyncpg 호환)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-28 15:58:35 +09:00

12 lines
582 B
SQL

-- 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));