DrizzleORM v0.30.8 release
Apr 11, 2024

New Features

  • Added custom schema support to enums in Postgres (fixes #669 via #2048):
import { pgSchema } from 'drizzle-orm/pg-core';

const mySchema = pgSchema('mySchema');
const colors = mySchema.enum('colors', ['red', 'green', 'blue']);

Learn more about Postgres schemas and enums.

Fixes

  • Changed D1 migrate() function to use batch API (#2137)

To get started with Drizzle and D1 follow the documentation.

  • Split where clause in Postgres .onConflictDoUpdate method into setWhere and targetWhere clauses, to support both where cases in on conflict ... clause (fixes #1628, #1302 via #2056).
await db.insert(employees)
  .values({ employeeId: 123, name: 'John Doe' })
  .onConflictDoUpdate({
    target: employees.employeeId,
    targetWhere: sql`name <> 'John Doe'`,
    set: { name: sql`excluded.name` }
  });
  
await db.insert(employees)
  .values({ employeeId: 123, name: 'John Doe' })
  .onConflictDoUpdate({
    target: employees.employeeId,
    set: { name: 'John Doe' },
    setWhere: sql`name <> 'John Doe'`
  });

Learn more about .onConflictDoUpdate method here.

  • Fixed query generation for where clause in Postgres .onConflictDoNothing method, as it was placed in a wrong spot (fixes #1628 via #2056).

Learn more about .onConflictDoNothing method here.

To get started with Drizzle and AWS Data API follow the documentation.