Files
PastpaperMaster/supabase/migrations/005_allow_long_question_format_alias.sql
Zhao 7a09167261 Initial commit: PastPaper Master full stack
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-21 12:27:47 +07:00

28 lines
863 B
SQL

-- ============================================
-- PastPaper Master — Allow legacy long_question format alias
-- Version: 005
-- Date: 2026-03-24
-- ============================================
--
-- Some existing seeds and older generated SQL used `long_question` in the
-- `question_format` column, while the 003 taxonomy migration introduced
-- `long_answer` as the canonical value. Allow both temporarily so historical
-- inserts do not fail. New generators should continue emitting `long_answer`.
ALTER TABLE paper_questions
DROP CONSTRAINT IF EXISTS paper_questions_question_format_check;
ALTER TABLE paper_questions
ADD CONSTRAINT paper_questions_question_format_check
CHECK (
question_format IN (
'mc',
'true_false',
'fill_blank',
'short_answer',
'long_answer',
'long_question',
'coding'
)
);