-- ============================================================================ -- Drop job_applications_screened_consistent -- -- A defect in migration 000001. The constraint reads: -- -- status = 'applied' OR screened_at IS NOT NULL OR ai_score = 0 -- -- which asserts that a screened application records *when* it was screened. -- The frontend makes no such promise: `screened_at` is never read and never -- written anywhere in the repository, and none of the 24 seeded applications -- carries it. The column and the constraint both came out of the backend -- blueprint rather than out of repository evidence. -- -- The effect was that 9 of 24 seeded applications were rejected — exactly the -- 9 AI-scored ones behind the "9 scored, averaging 76" regression anchor. -- -- 000001 is already applied and is immutable, so the fix lands here. All 52 -- other CHECK constraints from 000001 were verified against all 245 seeded -- records and hold. -- -- The `screened_at` column is kept: it is nullable and unused, and removing it -- is a separate cleanup rather than part of this fix. -- ============================================================================ SET search_path = public; ALTER TABLE public.job_applications DROP CONSTRAINT IF EXISTS job_applications_screened_consistent;