fix medipost_actions constraint

This commit is contained in:
2025-09-23 16:05:11 +03:00
parent 6492421c0d
commit edba074b38

View File

@@ -0,0 +1,12 @@
-- Fix medipost_actions unique constraint to work with ON CONFLICT
-- The previous partial index cannot be used with ON CONFLICT clause
-- Drop the existing partial unique index
DROP INDEX IF EXISTS "medreport"."medipost_actions_unique_by_private_message_id";
-- Create a proper unique constraint that can be used with ON CONFLICT
-- PostgreSQL unique constraints allow multiple NULL values by default
-- This will enforce uniqueness for non-NULL values while allowing multiple NULLs
ALTER TABLE "medreport"."medipost_actions"
ADD CONSTRAINT "medipost_actions_unique_by_private_message_id"
UNIQUE ("medipost_private_message_id");