OpenTelemetry in Drizzle v0.28.5 is disabled
OpenTelemetry logic in drizzle-orm is currently disabled and does nothing at runtime. It was designed as an optional feature for ORM users to collect query statistics and send them to their own telemetry consumers, but it is not actively used by Drizzle itself.
v0.28.5 fixed OpenTelemetry import runtime error
Version 0.28.5 fixed an issue where incorrect TypeScript import syntax caused the OpenTelemetry import statement to leak into runtime code. The fix involved using the correct `import type { ... }` syntax instead of `import { type ... }` syntax.
Drizzle ORM v0.29.0 requires Drizzle Kit v0.20.0 minimum
Drizzle ORM version 0.29.0 requires a minimum Drizzle Kit version of 0.20.0, and vice versa. When upgrading to a newer version of Drizzle ORM, you must also upgrade Drizzle Kit. Breaking changes may occur, especially if upgrading from Drizzle ORM versions older than 0.28.0.
selectDistinctOn not working with multiple columns fix
Drizzle v0.29.1 fixed an issue where selectDistinctOn was not working correctly with multiple columns. This fix was included in pull request #1466.
withReplica feature argument forwarding fix
Drizzle v0.29.1 fixed an issue where arguments were not being forwarded correctly when using the withReplica feature. This fix was included in pull request #1536.
Drizzle ESLint Plugin package
Drizzle v0.29.1 introduced the Drizzle ESLint Plugin package (eslint-plugin-drizzle) to assist developers in handling crucial scenarios during development where type checks are impossible or error messages would be challenging to understand.
enforce-delete-with-where ESLint rule
The enforce-delete-with-where ESLint rule enforces using the .where() clause in .delete() statements to prevent accidental deletion of all table rows. Error message: 'Without `.where(...)` you will delete all the rows in a table. If you didn't want to do it, please use `db.delete(...).where(...)` instead. Otherwise you can ignore this rule here'. The rule supports a drizzleObjectName option (string or string[]) to specify which object names should trigger the rule, useful when multiple classes have delete methods.
enforce-update-with-where ESLint rule
The enforce-update-with-where ESLint rule enforces using the .where() clause in .update() statements to prevent accidental update of all table rows. Error message: 'Without `.where(...)` you will update all the rows in a table. If you didn't want to do it, please use `db.update(...).set(...).where(...)` instead. Otherwise you can ignore this rule here'. The rule supports a drizzleObjectName option (string or string[]) to specify which object names should trigger the rule.
ESLint Drizzle Plugin configuration
ESLint Drizzle Plugin is configured via .eslintrc.yml file. Required fields: parser set to '@typescript-eslint/parser', parserOptions.project pointing to tsconfig.json, plugins including 'drizzle', and rules section specifying desired rules. The plugin exports 'all' and 'recommended' configs, which are currently equivalent.
Detailed JSDoc for all query builders
Drizzle v0.29.1 added detailed JSDoc for all query builders in all dialects, allowing developers to access more information, hints, and documentation links while developing in their IDE. Previously, JSDoc was only available for filter expressions.
ESLint Drizzle Plugin v0.2.3 new features
ESLint Drizzle Plugin v0.2.3 adds support for functions and improves error messages. The Drizzle object can now be passed directly or retrieved from a function, and error messages provide better context through suggestions.
DrizzleORM v0.29.2 release fixes
DrizzleORM v0.29.2 includes improvements to PlanetScale relational tests, correct string escaping for empty PgArrays, fix for wrong syntax of the exists function in SQLite, proper handling of dates in AWS Data API, and a fix for the Hermes mixins constructor issue.
Drizzle ORM v0.29.3 release - Expo peer dependencies optional
Drizzle ORM v0.29.3 was released on 2024-01-02. This release made expo peer dependencies optional (PR #1714). This fix allows users to work with Expo SQLite without being forced to install all Expo dependencies as required packages.
Neon HTTP Batch support in v0.29.4
Drizzle v0.29.4 added support for Neon HTTP Batch queries. Use db.batch() to execute multiple queries in a single request. The batch method accepts an array of queries and returns an array with results matching the order of input queries.
Neon HTTP Batch example with insert and query
The following example shows how to use Neon HTTP Batch with drizzle. Import neon from @neondatabase/serverless and drizzle from drizzle-orm/neon-http, create a sql instance with neon(), then pass it to drizzle(). Call db.batch() with an array containing insert operations and query operations. Insert operations can use .returning() to specify return fields, and query operations like findMany() and findFirst() can be included in the same batch:
```ts
import { neon } from '@neondatabase/serverless';
import { drizzle } from 'drizzle-orm/neon-http';
import { usersTable } from './schema';
const sql = neon(process.env.DRIZZLE_DATABASE_URL!);
const db = drizzle(sql);
const batchResponse: BatchType = await db.batch([
db.insert(usersTable).values({ id: 1, name: 'John' }).returning({
id: usersTable.id,
}),
db.insert(usersTable).values({ id: 2, name: 'Dan' }),
db.query.usersTable.findMany({}),
db.query.usersTable.findFirst({}),
]);
```
WITH clause support for INSERT, UPDATE, DELETE
Drizzle ORM v0.29.5 added support for using WITH (Common Table Expression) statements with INSERT, UPDATE, and DELETE statements. This allows you to define temporary named result sets that can be referenced in these DML operations.
OP-SQLite driver support added in v0.30.1
Drizzle ORM v0.30.1 added support for the OP-SQLite driver. To use it, import the open function from @op-engineering/op-sqlite, open a database with a name parameter, and pass it to drizzle() from drizzle-orm/op-sqlite.
Expo driver migration hook fixed in v0.30.1
Drizzle ORM v0.30.1 fixed the migration hook for the Expo driver.
Drizzle ORM v0.30.3 release features
Drizzle ORM v0.30.3 was released on 2024-03-19. It added raw query support (db.execute(...)) to batch API in Neon HTTP driver.
Drizzle ORM v0.30.3 bug fixes
Drizzle ORM v0.30.3 fixed an issue with @neondatabase/serverless HTTP driver types (issue #1945) and fixed sqlite-proxy driver .run() result.
findFirst query fix for bun:sqlite in v0.30.2
In Drizzle ORM v0.30.2, the findFirst query was fixed for bun:sqlite driver.
LibSQL migrations use batch execution instead of transactions
LibSQL migrations have been updated to utilize batch execution instead of transactions. A batch consists of multiple SQL statements executed sequentially within an implicit transaction. The backend handles the transaction: success commits all changes, while any failure results in a full rollback with no modifications.
Xata driver support in Drizzle v0.30.4
Drizzle ORM v0.30.4 added native support for the Xata driver via the drizzle-orm/xata package. Xata is a Postgres data platform focused on reliability, scalability, and developer experience. The Xata Postgres service is currently in beta.
PGlite driver support in Drizzle v0.30.6
Drizzle ORM v0.30.6 added support for the PGlite driver. PGlite is a WASM Postgres build packaged into a TypeScript client library that enables running Postgres in the browser, Node.js and Bun without installing additional dependencies. It is 2.6mb gzipped. PGlite can be used as an ephemeral in-memory database or with persistence to the file system (Node/Bun) or indexedDB (Browser). Unlike previous "Postgres in the browser" projects, PGlite does not use a Linux virtual machine but is Postgres in WASM.
Drizzle v0.30.7 adds @vercel/postgres mappings
Drizzle v0.30.7 added mappings for the @vercel/postgres package, enabling support for Vercel Postgres as a driver.
Drizzle v0.30.7 fixes interval mapping for neon drivers
Drizzle v0.30.7 fixed interval type mapping for neon drivers, resolving issue #1542.
D1 migrate() function uses batch API
In Drizzle ORM v0.30.8, the D1 migrate() function was changed to use the batch API for improved performance and reliability.
Access full schema from Drizzle instance
Drizzle instances provide access to complete schema information via the `db._.fullSchema` property, added in v0.30.9.
useLiveQuery React Hook for Expo SQLite
Drizzle ORM v0.31.1 introduces native support for Expo SQLite Live Queries through a useLiveQuery React Hook. This hook observes necessary database changes and automatically re-runs database queries. It works with both SQL-like and Drizzle Queries.
Prisma-Drizzle extension available in v0.31.3
DrizzleORM v0.31.3 introduces a new Prisma-Drizzle extension that allows using Drizzle queries within Prisma. The extension is imported from 'drizzle-orm/prisma/pg' and is applied to a PrismaClient instance using the .$extends() method. After extending the PrismaClient with drizzle(), Drizzle queries can be executed via the $drizzle property, such as prisma.$drizzle.select().from(User).
Prisma-Drizzle extension usage example
import { PrismaClient } from '@prisma/client';
import { drizzle } from 'drizzle-orm/prisma/pg';
import { User } from './drizzle';
const prisma = new PrismaClient().$extends(drizzle());
const users = await prisma.$drizzle.select().from(User);
RQB behavior fixed for tables with same names in different schemas
DrizzleORM v0.31.3 fixed a bug in RQB (Relational Query Builder) behavior when handling tables with the same names across different schemas.
RDS Data API type hints mismatch fixed
DrizzleORM v0.31.3 fixed a bug causing mismatched type hints when using the RDS Data API (issue #2097).
pg_vector distance helper functions
Drizzle provides vector distance helper functions: l2Distance(table.column, [3, 1, 2]), l1Distance(table.column, [3, 1, 2]), innerProduct(table.column, [3, 1, 2]), cosineDistance(table.column, [3, 1, 2]), hammingDistance(table.column, '101'), and jaccardDistance(table.column, '101'). These are imported from 'drizzle-orm'.
pg_vector index operators
pg_vector index operators supported: vector_l2_ops, vector_ip_ops, vector_cosine_ops, vector_l1_ops, bit_hamming_ops, bit_jaccard_ops. Indexes are created using .using('hnsw', table.embedding.op('vector_l2_ops')) syntax.
drizzle-orm v0.31.0 requires drizzle-kit v0.22.0 or higher
drizzle-orm version 0.31.0 can only be used with drizzle-kit version 0.22.0 or higher. When running a Drizzle Kit command, it will check and prompt for an upgrade if needed.
PostgreSQL indexes API changed in v0.31.0
The PostgreSQL indexes API was changed in v0.31.0 to align with PostgreSQL documentation. Sorting modifiers (.asc(), .desc(), .nullsFirst(), .nullsLast()) must now be specified for each column or expression, not on the index itself. The .using() method now specifies the index type. The .on() method now accepts columns with sorting modifiers.
PostgreSQL indexes new API syntax with .on()
New PostgreSQL indexes API using .on(): index('name').on(table.column1.asc(), table.column2.nullsFirst(), ...).concurrently().where(sql``).with({ fillfactor: '70' }). Or with .onOnly(): index('name').onOnly(table.column1.desc().nullsLast(), table.column2, ...).concurrently().where(sql``).with({ fillfactor: '70' })
PostgreSQL indexes new API syntax with .using()
New PostgreSQL indexes API using .using(): index('name').using('btree', table.column1.asc(), sql`lower(${table.column2})`, table.column1.op('text_ops')).where(sql``).with({ fillfactor: '70' })
pg_vector extension support added
Drizzle v0.31.0 adds support for PostgreSQL pg_vector extension. You can specify indexes for pg_vector and use pg_vector functions for querying and ordering. The pg_vector extension must be installed on the PostgreSQL database; Drizzle does not create the extension itself.
PostgreSQL point type with tuple and xy modes
PostgreSQL point type supports two modes: 'tuple' (default) maps to [x, y] array, and 'xy' maps to { x: number, y: number } object. Usage: point('point') or point('point_xy', { mode: 'xy' })
PostgreSQL line type with tuple and abc modes
PostgreSQL line type supports two modes: 'tuple' (default) maps to [a, b, c] array, and 'abc' maps to { a: number, b: number, c: number } object representing the equation Ax + By + C = 0. Usage: line('line') or line('line_abc', { mode: 'abc' })
PostGIS extension support added
Drizzle v0.31.0 adds basic support for PostgreSQL PostGIS extension. The PostGIS extension must be installed on the PostgreSQL database; Drizzle does not create the extension itself.
PostGIS geometry type configuration
PostGIS geometry type: geometry('geo', { type: 'point' }). Supports modes: 'tuple' (default) and 'xy'. Optional srid parameter: geometry('geo_options', { type: 'point', mode: 'xy', srid: 4000 }). The type parameter can be any string for different PostGIS geometry types.
Drizzle ORM v0.31.4 release date and change
Drizzle ORM version 0.31.4 was released on July 8, 2024. The main change in this release was marking the prisma clients package as optional.
Drizzle ORM v0.32.1 indexes support 3+ columns with expressions
Drizzle ORM v0.32.1 fixed typings for indexes and added support for creating indexes on 3 or more columns while mixing columns and expressions.
Drizzle ORM v0.32.1 supports limit 0 in all dialects
Drizzle ORM v0.32.1 added support for "limit 0" in all dialects.
Drizzle ORM v0.32.1 inArray and notInArray accept empty lists
Drizzle ORM v0.32.1 made the inArray and notInArray operators accept empty lists.
v0.32.2 SQLite package exports additional types
Version 0.32.2 exports additional types from the SQLite package, including AnySQLiteUpdate.
Drizzle ORM v0.32.2 release date
Drizzle ORM v0.32.2 was released on August 5, 2024.
v0.32.2 bug fix: AWS Data API type hints in RQB
Version 0.32.2 fixes AWS Data API type hints bugs in the RQB (Raw Query Builder).
v0.32.2 useLiveQuery forwarding dependencies fix
Version 0.32.2 adds forwarding dependencies within useLiveQuery, which fixes issue #2651.
drizzle-orm v0.32.0 and drizzle-kit v0.23.0 upgrade requirement
It is not mandatory to upgrade both packages, but if you want to use the new features in both queries and migrations, you must upgrade both packages.