-- Restores the constraint dropped by 000003. -- -- NOTE: this will FAIL on any database holding the seeded demo dataset, because -- that data is what the constraint rejects. That is the point of dropping it. -- Roll back only on a database whose applications satisfy the predicate. SET search_path = public; ALTER TABLE public.job_applications ADD CONSTRAINT job_applications_screened_consistent CHECK ( status = 'applied' OR screened_at IS NOT NULL OR ai_score = 0 );