fix constraint

This commit is contained in:
2025-09-23 16:24:59 +03:00
parent 8794bf998c
commit cd3d2586f7

View File

@@ -0,0 +1,9 @@
-- Drop existing constraint and index for analysis_response_elements
DROP INDEX IF EXISTS "medreport"."analysis_response_elements_unique_by_response_and_element";
ALTER TABLE "medreport"."analysis_response_elements"
DROP CONSTRAINT IF EXISTS "analysis_response_elements_unique_by_response_and_element";
-- Create proper unique constraint that works with ON CONFLICT
ALTER TABLE "medreport"."analysis_response_elements"
ADD CONSTRAINT "analysis_response_elements_unique_by_response_and_element"
UNIQUE ("analysis_response_id", "analysis_element_original_id");