Skip to content

Commit

Permalink
fix: add unique position contraint as deferred (#330)
Browse files Browse the repository at this point in the history
  • Loading branch information
pratikmishra356 authored Jan 3, 2025
1 parent 28e3b7c commit 2f507df
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
-- This file should undo anything in `up.sql`
ALTER TABLE public.dimensions
ALTER COLUMN priority DROP DEFAULT;
ALTER COLUMN priority DROP DEFAULT;

ALTER table public.dimensions drop constraint if exists dimension_unique_position;
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ ALTER TABLE public.dimensions
ALTER COLUMN priority SET DEFAULT 1;

ALTER TABLE public.dimensions
ADD CONSTRAINT dimension_unique_position UNIQUE (position);
ADD CONSTRAINT dimension_unique_position UNIQUE (position) DEFERRABLE INITIALLY IMMEDIATE;

SET CONSTRAINTS dimension_unique_position DEFERRED;

0 comments on commit 2f507df

Please sign in to comment.