Files
krow_backend/migrations/000003_drop_screened_consistent_check.down.sql
2026-08-24 13:06:29 +05:30

13 lines
480 B
SQL

-- 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
);