fix medipost_actions constraint
This commit is contained in:
@@ -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");
|
||||||
Reference in New Issue
Block a user