-- Apply before deploying the comprehension API. Existing rounds remain legacy. alter table public.challenge_rounds add column if not exists comprehension_question text; alter table public.challenge_rounds add column if not exists comprehension_model_answer text; alter table public.submissions add column if not exists comprehension_answer text; alter table public.submissions add column if not exists comprehension_grade integer check (comprehension_grade between 0 and 2); alter table public.submissions add column if not exists comprehension_graded_at timestamptz; alter table public.challenge_rounds enable row level security; revoke all on table public.challenge_rounds from anon, authenticated; grant select, insert, update, delete on table public.challenge_rounds to service_role; alter table public.submissions enable row level security; revoke all on table public.submissions from anon, authenticated; grant select, insert, update on table public.submissions to service_role;