Drizzle ORM, Drizzle Kit and Drizzle Pulse v1.0.0-rc.6 release
Drizzle ORM
Breaking changes
-
Drivers no longer configure output decoding in drivers’ configurations - following configurations set by drizzle constructors were removed:
client.options.bigint = truefrombun-sql/postgres,bun-sql/mysql- transparent decoders from
postgres-js - global
types.setTypeParser(...)fromneon-http,netlify-db - per-query parser overrides from
rawmode and other queries not decoded by codecs (node-postgres,node-postgres/dsql,vercel-postgres,neon-serverless,netlify-db,cockroach,pglite,mysql2)
Important:
postgres-jsstill overrides client’s param serializers (client-wide, replacing user-configured ones) fortimestamptz(1184),timestamp(1114),date(1082),time(1083) and their arrays:Datevalues are sent asvalue.toISOString()- same aspostgres.js’ default fortimestamptz,timestamp,date- strings are sent as is to be parsed by the server -
postgres.js’ default re-encodes them vianew Date(value).toISOString(), which reads offset-less timestamps in process’ local time, truncates microseconds and throws on values JS can’t parse ('infinity','12:00:00') timeswitchesDateprocessing fromdate.toString()to ISO string
sqlite: integer-based codecs (integer,integer:boolean,integer:timestamp,integer:timestamp_ms) acceptnumber,bigintand integer text, which makes them independent of safe integer modes (better-sqlite3’sdefaultSafeIntegers,bun:sqlite’ssafeIntegers,node:sqlite’sreadBigInts,libsql’sintMode)Important: Results of raw queries (
db.execute(sql...)) now honor driver’s configurationNote: Codecs only cover client options with predictable output (
bigint,safeIntegers,intMode,decimalNumbers,jsonStrings, …). Custom parsing functions (pg’stypes.setTypeParser(...)/types.getTypeParser,postgres’types,mysql2’stypeCast) that change output of types drizzle doesn’t request per query still require custom codecs, e.g.:import { refineCodecs } from 'drizzle-orm/codecs'; import { drizzle, mysql2Codecs } from 'drizzle-orm/mysql2'; import { createPool } from 'mysql2/promise'; const client = createPool({ uri: process.env.DATABASE_URL, typeCast: (field, next) => { // `tinyint(1)` is returned as `boolean` instead of `number` if (field.type === 'TINY' && field.length === 1) return field.string() === '1'; // `BLOB`-typed fields (`text`, `blob` columns) are returned as `Buffer` instead of `string` if (field.type === 'BLOB') return field.buffer(); return next(); }, }); const fromBuffer = (value: Buffer) => value.toString('utf8'); const db = drizzle({ client, codecs: refineCodecs(mysql2Codecs, { // default `boolean` codec expects `0` / `1` - client's output is already final boolean: { normalize: undefined }, // text codecs have no decoders by default - client's output is expected to be a string text: { normalize: fromBuffer }, mediumtext: { normalize: fromBuffer }, }), });import { refineCodecs } from 'drizzle-orm/codecs'; import { arrayCompatNormalize, arrayCompatNormalizeInput } from 'drizzle-orm/pg-core'; import { drizzle, postgresJsCodecs } from 'drizzle-orm/postgres-js'; import postgres from 'postgres'; type Line = [a: number, b: number, c: number]; const client = postgres(process.env.DATABASE_URL, { types: { // `point` (and `point[]`) is returned as `{ x, y }` instead of `(x,y)` text point: { to: 600, from: [600], // drizzle already encodes points to `(x,y)` text serialize: (value: string) => value, parse: (value: string) => { const [x, y] = value.slice(1, -1).split(',').map(Number); return { x, y }; }, }, // `line` (and `line[]`) is returned as `[a, b, c]` instead of `{a,b,c}` text, params are expected as `[a, b, c]` line: { to: 628, from: [628], serialize: ([a, b, c]: Line) => `{${a},${b},${c}}`, parse: (value: string) => value.slice(1, -1).split(',').map(Number) as Line, }, }, }); const toABC = ([a, b, c]: Line) => ({ a, b, c }); const toLine = (value: string) => value.slice(1, -1).split(',').map(Number) as Line; const db = drizzle({ client, codecs: refineCodecs(postgresJsCodecs(client), { // default `point` codecs parse `(x,y)` text - client's output is already final point: { normalize: undefined, normalizeArray: undefined }, // `line({ mode: 'abc' })` columns line: { normalize: toABC, normalizeArray: arrayCompatNormalize(toABC), // drizzle encodes `{ a, b, c }` to `{a,b,c}` text normalizeParam: toLine, // `postgres.js` 4 serializes array params element by element, with the type's `serialize` - elements are typed, // or it would read the tuples as nested arrays normalizeParamArray: arrayCompatNormalizeInput((value: string) => client.typed(toLine(value) as any, 628)), }, }), }); -
Removed cast codecs: selected columns are no longer wrapped in casts (
::text,cast(... as char), epoch milliseconds, …) and set operations inselect ... from (...) "drizzle_union"(exceptsinglestore);toSQL()/getSQL()of query builders lost theirwithCastCodecsswitch. This fixesselect distinct ... order by <column>being invalid onpg,cockroach,mysql,mssql(fixes #6673). Changes that came with it:- Returned data:
- Queries decoded by codecs (with a mapper - not
db.execute,db.call) request lossless output per query; the overrides are exported for proxy servers, which apply them in their own callback implementations (nodePgRawTextTypes,nodePgDsqlRawTextTypes,neonServerlessRawTextTypes,neonHttpRawTextTypes,vercelPgRawTextTypes,netlifyDbRawTextTypes,nodeCockroachRawTextTypes,pgliteRawTextParsers,decodePostgresJsRawRows,makeMySql2RawTextTypeCast,makeSingleStoreRawTextTypeCast,makePlanetscaleRawTextCast,tidbRawTextDecoders,awsDataApiRawTextResultSetOptions):node-postgres,node-postgres/dsql,neon-serverless,neon-http,vercel-postgres,netlify-db,cockroach: per-querytypesreturningdate,timestamp,timestamptz,interval,numeric[]and their arrays as text (fixes #6290);pglite: per-queryparsersfor the same types;postgres-js:rawmode, decoding the same types as text and others with the client’s own parsersmysql2,singlestore: per-querytypeCast(bigint,decimal,date,datetime,timestampas text,jsonparsed, other fields through the client’s owntypeCast);planetscale-serverless: per-querycast;tidb-serverless: per-querydecoders;aws-data-api/pg:longReturnType: 'STRING'better-sqlite3,node-sqlite,bun-sqlite,tursodatabase,tursodatabase-sync,tursodatabase-serverless,effect-sqlite-node,effect-sqlite-bun: integers asbigints per statement, sonumerickeeps integers past the safe range. Important: Integersqlfields without.mapWith()arebigints on these drivers
- Other drivers’ output is decoded as returned. Column types the driver returns with data already lost throw
Column type "<type>" is not supported with the <driver> driver: <reason>(each driver’sdrizzle()docs list them, with quirks):pg,cockroachdrivers decoding text: temporal values in sessions with non-ISODateStylebun-sql/postgres,effect-postgres,effect-pglite,aws-data-api/pg,postgres/aurora:timestamptzinstringmode (offset of the session’s time zone dropped)effect-pglite:timestamp(process-local time)effect-postgres:macaddr,macaddr8,enum[],geometry,vector,halfvec,sparsevec(binary format decoded as corrupted text);point,line,bit,interval[], multidimensional arrays fail in the driveraws-data-api/pg,postgres/aurora:timetz(offset dropped),bytea[](returned empty)node-mssql:decimal,numericinstringmode, values past the safe range inbigintmoded1,sql-js,expo-sqlite,op-sqlite,durable-sqlite,sqlite-cloud,effect-d1,effect-sqlite-do:numericintegers past the safe range (libsql,effect-libsqlwithintMode: 'number'fail in the driver)
- Driver quirks, decoded as returned:
floatrounded to 6 significant digits (mysql2,singlestore,planetscale-serverless;bun-sql/mysqlin queries without bound parameters);timecut to milliseconds,BCdropped from fractionaltimestamps,nullarray elements dropped (aws-data-api/pg,postgres/aurora); BCdates read asInvalid Dates, years 1 - 99 oftimestamptzread as 19xx (effect-pglite); microseconds of string-modetimestamp,datetime(bun-sql/postgres,bun-sql/mysql,effect-postgres) - Set operation fields are decoded by the left-hand side’s codec (
pg,cockroach,mssql,singlestore) or the codec of the combined type (mysql,sqlite);sqliteblob∪numericbigintfields are decoded per row by the storage class they came in bun-sql/postgres:infinity,-infinitydates and timestamps (Infinitynumbers frombun) are decoded toInvalid Dates,'infinity'/'-infinity'instringmode
- Queries decoded by codecs (with a mapper - not
- Drizzle instance creation:
effect-mysql2:makerejects clients created withoutdateStrings: true(poolConfig, or?dateStrings=trueinurl) or withdecimalNumbers: truebun-sql/sqlite:drizzle()rejectsSQLclients created withoutsafeIntegers: true(orbigint: true), clients it creates from connection strings set it
- Corrections of earlier release notes:
- rc.4 “Fixed
mysqlfloatrounding”: holds foreffect-mysql2only, other drivers round per the quirk above - rc.4 “Fixed
mysqlcropping.000fromtimestamp(3)”: holds except foreffect-mysql2,bun-sql/mysql, which drop trailing zeros of fractional seconds - rc.4 set operator
drizzle_unionwrapping and combined-type codecs: see set operations above - rc.5
bun-sql/mysql,mysql2,singlestore“castcodecs”: replaced by per-querytypeCast(mysql2,singlestore) and decoding as returned (bun-sql/mysql) - rc.5
withCastCodecsswitch, “Fixed cast codecs being applied to selection fields of inner queries”, “FixedsqlitegeneratingView,Subqueryqueries withcastonnumericcolumns”: no longer apply - rc.5 “Fixed
mysqldatecolumn being affected by server’s timezone” (#1442):effect-mysql2requiresdateStrings: truefor it - rc.5 “Fixed
effect-mysql,bun-sql/mysqldrivers losingtimefraction”:effect-mysql2drops trailing zeros of the fraction - rc.5
aws-data-api/pgtime({ withTimezone: true })results converted to UTC: such columns throw now (see above)
- rc.4 “Fixed
- Returned data:
-
postgres-js: supportedpostgres4 (json[],jsonb[]params are sent as typed elements on 4, as array literals on 3); bumped the tested version to4.1.1-postgresbefore 4.0.0 decodesnullarray elements asNaN,'NULL',falseor throws (json,jsonb) -
Changed
postgresJsCodecs(drizzle-orm/postgres-js,drizzle-orm/postgres-js/dsql),bunSqlPgCodecs(drizzle-orm/bun-sql/postgres) from plain objects to(client) => codecsfunctions due tojsonparam wrapper functions only being accessible from drivers viaclient.json(param) -
Fixed
bun-sql/mysqldatetimeinstringreturning trailing zeroes for empty second fractions -
Bumped minimal supported version of
@types/mssqlpeer dependency from9.1.4to9.1.11to match declarations ofmssql@11.0.1; changedmssql,@types/mssqlpeer dependency version requirements from^to>= -
Changed shapes of dialect-specific
concat,substringexpressions (drizzle-orm/<dialect>-core/expressions) to match their dialects’ functions:mysql,singlestore,mssql:concat(a, b, ...rest)now accepts any number of values (string,number,bigint,Placeholder,SQLWrapper) and emitsconcat(...)instead of||, which is a logicalORinmysql,singlestoreand is unsupported bymssqlbefore SQL Server 2025mysql,singlestore:substring(column, { from, for? })-fromis now required (substring(x for n)is a syntax error);from,foracceptbigintpg,cockroach:substring(column, { from?, for? })now requires at least one offrom,for(substring(x)is an error);fromis cast tointeger(pg) /int8(cockroach) due tosubstring(text from pattern)overload being picked by default;cockroachpositions acceptbigintpg,cockroach: added regular expressionsubstringoverloads:substring(column, { fromPattern })- POSIX regular expression (substring(x from pattern))pg:substring(column, { similar, escape })- SQL regular expression (substring(x similar pattern escape escape))cockroach:substring(column, { fromPattern, escape })- POSIX regular expression withescapein place of\(substring(input, regex, escape_char))
sqlite:substring(column, { from?, for? })->substring(column, start, length?), emitssubstr(x, start[, length])instead of unsupportedsubstring(x from ... for ...);start,lengthacceptbigintmssql:substring(column, { from?, for? })->substring(column, start, length), emitssubstring(x, start, length)instead of unsupportedsubstring(x from ... for ...)concatvalues andsubstringarguments are no longer encoded with the column’s encoder - they are not expected to share the column’s type
-
Fixed subqueries selected as fields being inferred as non-nullable - a subquery can return no rows, so their values are now typed as
| null. This also applies to such fields re-selected from views and subqueries built from these selections:const res = await db.select({ id: users.id, // before: number, now: number | null lastPostId: db.select({ id: posts.id }).from(posts).where(eq(posts.authorId, users.id)).orderBy(desc(posts.id)).limit(1).as('last_post_id'), }).from(users); -
Removed query caching:
drizzle-orm/cache/coreanddrizzle-orm/cache/upstashmodules,cacheoption of drizzle constructors,db.$cache,.$withCache()of select queries,withCacheoption of relational queries,EffectCacheservice of Effect drivers (DefaultServicesnow provides onlyEffectLogger),drizzle-orm/used-tablesmodule -
mysql,singlestore:$returningIdcan no longer be combined withonDuplicateKeyUpdateas the result can’t report updated rows’ ids -
pg,cockroach,mysql,singlestore,sqliteno longer silently drop non-positive pagination params -
pg: removed.concurrently()from indexes - migrations run inside a transaction, wherecreate index concurrentlycan’t be executed -
Fixed
Effectdrivers waiting for query logger to finish execution to execute query: logging is now detached withEffect.forkDetach -
Removed migrations table upgrade helpers, replaced by migrators shared across runtimes and drivers:
drizzle-orm/up-migrations/mysql,drizzle-orm/up-migrations/mysql-proxy,drizzle-orm/up-migrations/singlestore,drizzle-orm/up-migrations/singlestore-proxy,drizzle-orm/up-migrations/pg-proxy,drizzle-orm/up-migrations/effect-mysql,drizzle-orm/up-migrations/effect-pg,drizzle-orm/up-migrations/effect-sqlitemodules (upgradeIfNeeded),drizzle-orm/up-migrations/sqlite-proxymodule (upgradeAsyncIfNeeded)upgradeIfNeededfromdrizzle-orm/up-migrations/pg,upgradeSyncIfNeededandupgradeAsyncIfNeededfromdrizzle-orm/up-migrations/sqlite
-
drizzle-ormis published as ESM only: CommonJS output (.cjs,.d.cts) andrequireexport conditions were removed. Addedengines.node:^20.19.0 || >=22.12.0- Node versions that canrequire()ES modules, so CommonJS projects on them keep working throughrequire(esm) -
drizzle-orm/postgres: the Drizzle Postgres driver (formerly@drizzle-team/minipg) now ships insidedrizzle-orm:- removed the
@drizzle-team/minipgpeer dependency - the driver’s API is re-exported fromdrizzle-orm/postgresentries, its own entries are available asdrizzle-orm/postgres/client/* - renamed
minipgCodecs,minipgShapeCodecs->postgresCodecs;minipgAuroraCodecs,minipgAuroraShapeCodecs->postgresAuroraCodecs - moved the Neon HTTP driver from
drizzle-orm/postgres/http/neontodrizzle-orm/postgres/neon-http
- removed the
New features
-
Drizzle Postgres (
drizzle-orm/postgres):- Added
db.pipeline([...])for sending queries back-to-back on one pooled connection anddb.parallel([...])for running queries concurrently across the pool. Both run without a shared transaction and return onePromiseSettledResultper query. The HTTP variants differ in how they send queries. db.batch([...], options)accepts transaction options (isolation,readOnly,deferrable,snapshot). The driver sends the batch in one round trip and exposes telemetry asresponse.metricswhen you passmetrics: true | 'ms' | 'us'.- Added
db.bulkInsert(table, rows, options?)for multi-row inserts anddb.bulkUpdate(table, rows, { by })for updates matched by key usingunnest. Both apply the relevant runtime defaults and run chunks in one transaction by default. Setatomic: falseto commit each chunk separately.
- Added
-
Added
drizzle-orm/postgres/pglite- Drizzle Postgres over an in-process PGlite instance (named statements, pipelining,batch,pipeline, bulk methods):import { drizzle } from 'drizzle-orm/postgres/pglite'; const db = drizzle(); // in memory const db = drizzle('./data'); // in a data directory const db = drizzle({ connection: await PGlite.create() }); // on your own instance, left open when the pool closes -
Added Effect drivers for Drizzle Postgres:
drizzle-orm/postgres/effect,drizzle-orm/postgres/effect/http,drizzle-orm/postgres/effect/neon-http,drizzle-orm/postgres/effect/aurora(make,makeWithDefaults), with the samebatch,pipeline,parallel,bulkInsert,bulkUpdatemethods as their async counterparts, as Effects (pipelineandparallelgive aResultper query). The EffectSqlClientlayers they run on are re-exported from the same entries (DrizzlePostgresClient; Neon WebSocket and PGlite variants indrizzle-orm/postgres/client/effect/neon-ws,drizzle-orm/postgres/client/effect/pglite). Requireeffect4.1.3 or laterimport * as PostgresDrizzle from 'drizzle-orm/postgres/effect'; import { DrizzlePostgresClient } from 'drizzle-orm/postgres/effect'; const program = Effect.gen(function*() { const db = yield* PostgresDrizzle.makeWithDefaults({ relations }); return yield* db.select().from(users); }).pipe(Effect.provide(DrizzlePostgresClient.layer({ url: Redacted.make(process.env.DATABASE_URL!) }))); -
Added
drizzle-orm/postgres/cdc- change data capture over logical replication (replicate(options),pool.replicate(options)) -
drizzle-orm/postgres: the driver detects transaction-mode poolers of more vendors from host and port (Supabase transaction mode, PgBouncer on port 6432, PlanetScale Postgres, Prisma Postgres, Neon / Vercel pooled hosts, Vercel serverless runtime) and adjusts named statements and pipelining to them; undetectable poolers are declared withpooler: trueor?pooler=true/?pgbouncer=true. Pipelining depth defaults to'auto'- picked from the connection’s measured round trip -
sqlite: addedrowId.big()for row ids pastNumber.MAX_SAFE_INTEGER;rowId()is mapped withNumber, so it stays anumberon drivers that now read integersqlfields asbigints (see cast codecs removal)
Improvements and fixes
-
Fixed
effect-postgresfailing to encode empty array params (Cannot infer the type of an empty array) oftext,varchar,char,bool,smallint,int,bigint, serial types,float4,float8,byteacolumns (fixes #6566) -
Fixed
effect-postgresbigint,bigserialcolumns inbigintmode returning strings whenPgClientdecodesint8as text (fixes #6566) -
Fixed
db.$clientofeffectdrivers being typed as the client’s interface instead of its service’s shape oneffect >=4.1.3(fixes #6685) -
Fixed
bun-sqlpostgresbigint,bigserialcolumns inbigintmode returning strings sincebunstarted ignoringoptions.bigintset after client’s construction -
Fixed
bun-sqlpostgresempty multidimensionalintegerarrays being returned asInt32Array -
Fixed
is()narrowing columns tonever:pg:text,varchar,charwithenum(is(column, PgText)), plainvarchar,charcockroach:cockroachEnumcolumns (is(column, CockroachEnumColumn))mysql:blob,tinyblob,mediumblob,longblobinbuffermode (is(column, MySqlBufferBlob))
-
Fixed
mysql,singlestoreenum columns narrowed byis()havingcolumn.enumValuestyped as| undefined -
Fixed
cockroachcockroachEnumcolumns being typed withstringdataTypeinstead ofstring enum, which made validators inferstringinstead of the enum’s values -
Fixed
mysqlblob,tinyblob,mediumblob,longblobinbuffermode havingstringdataTypeinstead ofobject buffer, which made validators generate string schemas forBuffervalues -
Fixed validators inferring
stringinstead of enum members for columns of enums made from TS enums (pgEnum,cockroachEnum,mysqlEnum) -
Fixed
drizzle-orm/zodcreateSchemaFactorywithoutcoerceoption breaking refine callbacks’ parameter type inference (Parameter 'schema' implicitly has an 'any' type) (fixes #5968) -
Fixed
postgres-jserrors onjson,jsonbcolumns’ params withboolean,Date,Buffer,Uint8Arrayvalues and arrays starting with them (column "..." is of type jsonb but expression is of type ...) (fixes #6582) -
Fixed
bun-sql/postgreserrors onjson,jsonbcolumns’ params with top-levelnumber,boolean,Buffer,Uint8Arrayvalues (fixes #6591) -
Fixed
bun-sql/postgreswithprepare: falseerrors onjson,jsonbcolumns’ params (fixes #6132) -
Fixed
node-postgres,neon-serverless,vercel-postgres,netlify-dberrors onjson,jsonbcolumns’ params withDate,Buffer,Uint8Arrayvalues (invalid input syntax for type json) -
Fixed type errors in emitted declarations with
skipLibCheck: false(fixes #5187):Cannot find module 'mysql2'in projects withoutmysql2installed - general modules (drizzle-orm,drizzle-orm/pg-core, …) no longer reference driver packages’ typesClass 'PgRole' incorrectly implements interface 'PgRoleConfig'(same forPgPolicy,CockroachRole,CockroachPolicy) withexactOptionalPropertyTypesType 'Buffer' is not genericon TypeScript 5.6 and older inmysql-coreblobcodecs anddrizzle-orm/arktype’sbufferSchema
-
Fixed query builders dropping offset with
0value (fixes #6599) -
Fixed
node-postgres,cockroach,neon-serverless,netlify-db,vercel-postgrestransactions returning client to the pool after failedbegin(fixes #6622) -
Fixed
durable-sqlite.get()and.run()leaving statements unfinished on multi-row results;.run()result is now typed as finished cursor’scolumnNames,rowsRead,rowsWritten(fixes #6550) -
Fixed
effect-sqlite-do,effect-sqlite-bun,effect-sqlite-wasm.run()result type:[]->readonly Record<string, unknown>[] -
Fixed
sqlite-coreonConflictDoNothing({ target, where })placingwhereafterdo nothing(fixes #6531) -
Fixed
pg,cockroachtimestamp,datecolumns failing to encodeDatevalues outside of year 1 - 9999 range (fixes #6552):- years past 9999 (
+010000-01-01T00:00:00.000Z) are sent without the expanded-year sign:10000-01-01T00:00:00.000Z - years before 1 AD (
0000-01-01T00:00:00.000Z,-000001-...) are sent with theBCsuffix:0001-01-01T00:00:00.000Z BC
- years past 9999 (
-
Fixed
pg,cockroachtimestamp,datecolumns indatemode decoding values thatnew Date(text)misreads:- years 1 - 99 were read as two-digit years (
0099-12-31 23:59:59+00-> 1999) datevalues past year 9999 were read in process’ local time- values with the
BCsuffix and with seconds-precision UTC offsets were decoded asInvalid Date
- years 1 - 99 were read as two-digit years (
-
Fixed
pgtimestamp,datecolumns indatemode being decoded as wrong dates orInvalid Datein sessions with non-ISODateStyle(fixes #6496): drivers decoding text now throw on such values instead (see cast codecs removal) -
Documented
aws-data-api/pg,postgres/auroratimecolumns losing fractional seconds past milliseconds andtimestampcolumns losing theBCsuffix of values with fractional seconds as driver quirks: columns are no longer cast in selections, Data API formats them itself with no per-query alternative -
Fixed
notreturningSQL | undefinedforSQLWrapperinput (fixes #6625) -
Fixed
pgtransaction config allowingsnapshotwithoutisolationLevel: 'repeatable read' | 'serializable'// before: compiled, failed at runtime; now: type error await db.transaction(async (tx) => { /* ... */ }, { snapshot }); // ok await db.transaction(async (tx) => { /* ... */ }, { isolationLevel: 'repeatable read', snapshot }); -
Fixed
nullelements ofpg,cockroacharray columns being passed into decoders\encoders instead of being kept asnull(fixes #6460): -
Fixed
json,jsonbpg,cockroacharray elements being written as JSONnullinstead of SQLnull -
Fixed: [BUG]: durable-sqlite migrate hides the error of a failed migration behind TransactionRollbackError
-
Fixed
$dynamic()builders being rejected by helpers constrained by generic builder types when.returning(),.from()or joins were applied before$dynamic()const withFilter = <T extends PgDelete>(qb: T) => qb.where(eq(users.id, 1)); // before: type error; now: { id: number }[] await withFilter(db.delete(users).returning({ id: users.id }).$dynamic()); -
Fixed
cockroachinsert().$dynamic(),update().$dynamic()builders losing.returning()result type and joins’ nullability forupdate -
Fixed
pgdb.$count()not being accepted as an item ofbatch,pipeline,parallel(postgres,postgres/http,neon-http,netlify-db)
Drizzle Kit
Breaking changes
postgressnapshot format bumped to 10 following removal of.concurrently()fromdrizzle-ormpgindexes:concurrentlyis dropped from format 9 index entries and indexcreate/alterdeltas on upgradedrizzle-kitis published as ESM only: thedrizzle-kitbinary,drizzle-kit/api-*,drizzle-kit/clianddrizzle-kit/payload/*entries lost their CommonJS builds andrequireexport conditions. Addedengines.node:^20.19.0 || >=22.12.0- Node versions that canrequire()ES modules
Improvements
- Faster
pull/pushintrospection on large schemas (PostgreSQL, CockroachDB, MySQL, SQLite, MSSQL) and faster PostgreSQL schema diffing pullerrors now carry their underlying cause for every dialect: printed after the message in text output, returned aserror.causein JSON output- MSSQL
pullreturns indexes sharing one name across tables in a stable order
Fixes
- [BUG]: PostgreSQL: after drizzle-kit pull, generate and push emit SET DEFAULT for a numeric column with an expression default
- Fixed
drizzle-kit pullwriting native function text into CockroachDB restrictive policies. - [BUG]: SQLite generate ignores an index changing between uniqueIndex and index
- [BUG]: Dropping a column writes a failing migration when a check or unique constraint naming it changes in the same diff
- [BUG]: drizzle-kit pull (MySQL) fails with “Check constraint conflict” when another database on the same server has a CHECK constraint with the same name
- [BUG]: SQL Server drizzle-kit pull error when IDENTITY seed = 0
- [BUG]: drizzle-kit push fails to introspect MSSQL schemas owned by Microsoft Entra users
- [BUG]: drizzle-kit for postgres generates incorrect migration when changing IDENTITY column to uuid
- Pull request #6188
- [BUG]: drizzle-kit pull writes an expression default as plain code or as a string for several column types (PostgreSQL, CockroachDB, SQLite, MySQL)
- [BUG]: MySQL generate stops when a new foreign key points to a table that is not exported from the schema
- [BUG]: drizzle-kit pull crashes on MSSQL when tablesFilter excludes referenced FK table
- [BUG]: SQLite pull reports every error after the connection as “Failed to connect to or introspect the SQLite database”, dropping the cause
- [BUG]: MySQL generate ignores onUpdateNow() for string-mode timestamp/datetime (rc.5)
- [BUG]: MySQL generate creates child foreign key before its new parent unique index (rc.5)
- [BUG]: SQLITE migration incorrectly uses ALTER table when adding a column with a non-constant default
- [BUG]: SQLite generate orders DROP TABLE alphabetically, so a parent can be dropped before the child that references it
- [BUG]: drizzle-kit ignores tsconfig
pathsmapping"*"under Node (only trailing/*keys supported) - [BUG]: drizzle-kit’s tsconfig path-alias resolver does not follow “extends”
Drizzle Pulse
Drizzle Pulse keeps query results up to date by streaming changes from PostgreSQL’s write-ahead log. It requires wal_level = logical and now follows the same release version as Drizzle ORM and Drizzle Kit.
See the Drizzle Pulse overview and server setup guide.
In this example, a live collection tracks orders with the accepted status. The event stream reports inserts, updates and deletes relative to that query result. See live collections and CDC event streams.
import { drizzle } from 'drizzle-orm/postgres';
import { pulse } from 'drizzle-pulse';
import { createRuntime } from 'drizzle-pulse/embedded';
import { z } from 'zod';
import { orders } from './schema.ts';
// Queries are defined once, on the server; `.args()` takes any Standard Schema
const ordersByStatus = pulse(orders)
.args(z.object({ status: z.enum(['requested', 'accepted', 'completed', 'cancelled']) }))
.query((ctx) => ctx.query({ status: ctx.args.status }));
const runtime = createRuntime({
queries: { ordersByStatus },
databaseUrl: process.env.DATABASE_URL!,
// the app's own connection: baseline reads keep its session context (RLS, `search_path`)
sourceDb: drizzle(process.env.DATABASE_URL!),
});
// provisions the publication, replication slot and events tables, then starts reading the WAL
await runtime.start();
// Live collection: current result, kept up to date
const accepted = await runtime.client.ordersByStatus({ status: 'accepted' });
console.log(accepted.list());
accepted.onChange(({ events, state }) => console.log(events, state));
// CDC event stream: `insert` / `update` / `delete` relative to the query's result
const unsubscribe = runtime.events.ordersByStatus({ status: 'accepted' }, (event, lsn) => console.log(event.op, lsn));Breaking changes
- Peer dependencies:
drizzle-ormraised to^1.0.0-rc.6; removed@drizzle-team/minipg- Pulse uses the Drizzle Postgres driver thatdrizzle-ormbundles (drizzle-orm/postgres,drizzle-orm/postgres/cdc); removedzod- query arguments take any Standard Schema - CDC event stream and live collection events are relative to the query result:
inserthasrow,updatehas the fullrowandoldRow,deletehasoldRow.matchesNewandold_rowwere removed from the embedded event types,PulseDeleteEventtakes the row type parameter .args()takes any Standard Schema with synchronous validation. Invalid arguments throw an error listing the validation issues. See query arguments.PulseBuildertype parameters are nowTTable,TSelection,TArgsInput,TArgsOutput,TResult,TFlags: callers pass the input type of the args schema,ctx.argsis its output type.PulseBuilder.configand its constructor are internalpulse(t).query(fn)typesctx.argsasRecord<never, never>;.args()throws after a where-function- Queries built with
.transform()or.limit()are missing fromruntime.clientandruntime.eventsat compile time - Opening a CDC event stream with a
whereon a column excluded by.columns()throws, as opening a live collection does - Opening a live collection or a CDC event stream takes no
authoption; removedPulseCollectionOptions TelemetryEvent:committedAt,appliedAtrenamed tocommittedAtMicros,appliedAtMicros(epoch microseconds)QueryDescriptormoved fromdrizzle-pulsetodrizzle-pulse/client;PulseAuthContextis exported fromdrizzle-pulseonlyPulseCollectionhas a private constructorEmbeddedRuntimeConfigis a type alias, as it takes eitherdatabaseUrlorclientstart()only adds tables to the publication: dropping unregistered tables from it and resetting their replica identity is done by provisioning only- Removed the
drizzle-pulse/package.jsonexport
New features
drizzle-pulse/embedded: added standaloneprovision({ queries, databaseUrl, wal })- does the same asruntime.provision()without a runtime orsourceDb, for deploy stepscreateRuntime()andprovision()take an optionalclient- a Drizzle PostgresPool(drizzle-orm/postgres) - in place ofdatabaseUrl. Pulse runs its admin queries on the pool and replication throughclient.replicate(), and doesn’t close the pool. Withoutclient, the driver bundled withdrizzle-ormis only imported when the runtime starts or provisions- Added
onResync,onErroroptions for CDC event streams drizzle-pulseexportsPulseAuthContext,PulseQueryContext,WhereClausetypes
Improvements and fixes
ColumnOperators.inaccepts readonly arrays- Errors and JSDoc use the terms live collection and CDC event stream, and document microsecond units, the slot name prefix and the publication rules