Deferrable foreign key constraints
Hi, does anyone know a way to declare deferrable foreign key constraints when defining a Postgres table using
pgTable
, and a way to issue SET CONSTRAINTS
within a transaction when querying in Drizzle? Thanks!
https://www.postgresql.org/docs/current/sql-set-constraints.htmlPostgreSQL Documentation
SET CONSTRAINTS
SET CONSTRAINTS SET CONSTRAINTS — set constraint check timing for the current transaction Synopsis SET CONSTRAINTS { ALL | name …
2 Replies
From what I can tell you can pass
deferrable: true
as config in the second arg to PgDatabase.transaction
, and that will handle the transaction side. This would have no affect on FKs that have not been set to deferrable, however, and I also have not been able to find a way to set thatIs there any update on this? Any way toset deferrable on a unique constraint?