-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Open
Labels
docsImprovements or additions to documentationImprovements or additions to documentation
Description
Enhancement hasn't been filed before.
- I have verified this enhancement I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
Besides the already supported typical table constraints , we model our schema to also verify violations to business rules, up to some extent.
An example is a table modeling a "calendar with events". There, I want to write a constraint that prevents multiple events from overlapping. That relies on a PostgreSQL extension. In SQL terms, this would be it:
#
# ... my table creation ...
#
CREATE EXTENSION IF NOT EXISTS btree_gist;
ALTER TABLE "public"."talent_availability_block" ADD CONSTRAINT "ex_no_overlap" EXCLUDE USING gist ("availability_day_id" WITH =, int4range("start_minute", "end_minute") WITH &&);
How can we use the typescript bindings on the Drizzle schema to model such a constraint? I couldn't find an example in the documentation, so had to manually edit the generated SQL for the migration. This isn't ideal since my Drizzle schema file now represents only partially the full extent of my table definition. Is it even possible to do it?
Metadata
Metadata
Assignees
Labels
docsImprovements or additions to documentationImprovements or additions to documentation