[FEATURE]: postgres: deferrable constraints

Author: ari-beckerCreated Oct 27, 2023Updated Sep 17, 2026
Labelsenhancementdrizzle/kitdb/postgres

Describe what you want

https://www.postgresql.org/docs/16/sql-createtable.html#SQL-CREATETABLE-PARMS-DEFERRABLE

I'm looking for something along the lines of:

typescript
export const foo = pgTable("foo",
  {
    name: text("name").notNull(),
  },
  (foo) => ({
    uniqueName: unique("name_unique", {deferrable: true, initially: "immediate"}).on(foo.name),
  }),
) satisfies PgTable;

Source: drizzle-team/drizzle-orm