-- 288_study_memo_cards_dedup_uq.sql -- dedup_hash 중복 카드 차단의 최종 방어선 (구조로 강제). -- append_card 의 ON CONFLICT (dedup_hash) DO NOTHING 이 매칭할 UNIQUE 제약 — 필수. -- PARTIAL (WHERE deleted_at IS NULL): supersede 로 retire 된 구버전 카드가 -- 같은 dedup_hash 의 새 추출을 막지 않도록 살아있는 카드만 유일성 강제. -- dedup_hash = sha256(source_question_id | format | normalize(정답토큰)). CREATE UNIQUE INDEX IF NOT EXISTS uq_study_memo_cards_dedup ON study_memo_cards (dedup_hash) WHERE deleted_at IS NULL;