CyberArena / db /schema /012_onevone_vuln_hunter.sql
Hussien Haider
H
7f68ba0
Raw
History Blame Contribute Delete
1.26 kB
-- Migration 012: extend onevone_matches.challenge_type CHECK to include
-- `vulnerability-hunter` (added to the verifier dispatch in
-- app/api/onevone.py after the table was created).
--
-- Idempotent: re-runnable; drops any existing constraint whose name starts
-- with `onevone_matches_challenge_type_check` and recreates it with the
-- extended whitelist.
BEGIN;
-- Drop the old constraint (if it exists under any of the names we've used).
ALTER TABLE public.onevone_matches
DROP CONSTRAINT IF EXISTS onevone_matches_challenge_type_check;
-- Add the new one with `vulnerability-hunter` allowed.
ALTER TABLE public.onevone_matches
ADD CONSTRAINT onevone_matches_challenge_type_check
CHECK (challenge_type IN (
'crypto',
'web',
'code-fixing',
'log-analysis',
'vulnerability-hunter'
));
COMMIT;
-- ---------------------------------------------------------------------------
-- Verification:
-- SELECT conname, pg_get_constraintdef(oid)
-- FROM pg_constraint
-- WHERE conrelid = 'public.onevone_matches'::regclass
-- AND conname = 'onevone_matches_challenge_type_check';
-- Expected: a single row whose definition includes all 5 values.
-- ---------------------------------------------------------------------------