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?
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server