Sayantan | Ironforge
Sayantan | Ironforge
Explore posts from servers
DTDrizzle Team
Created by Sayantan | Ironforge on 3/6/2024 in #help
Add a Exclusion Constraint for Postgres
I want to add an exclusion constraint to a table where I want to make sure there is only one row with flag set to true. Regular SQL would look like this,
CREATE TABLE my_table
(
id serial NOT NULL,
name text,
actual boolean DEFAULT false,
CONSTRAINT my_table_pkey PRIMARY KEY (id),
EXCLUDE (actual WITH =) WHERE (actual)
);
CREATE TABLE my_table
(
id serial NOT NULL,
name text,
actual boolean DEFAULT false,
CONSTRAINT my_table_pkey PRIMARY KEY (id),
EXCLUDE (actual WITH =) WHERE (actual)
);
Is there any way I can do this with Drizzle?
1 replies