note: no summary for this older release
We summarize recent releases. The original release notes for this version are below.
release-notesgithub.com/drizzle-team/drizzle-orm · 125 lines
- # v1.0.0-rc.1
- ⚠️ This release introduced a breaking change into our `casing` API([see below](#new-casing-api)) and removes RQB v1 `._query` for postgres
- ## JIT mappers
- Drizzle ORM now has an opt-in API for JIT(just in time compilated) mappers which make most expensive part of the db request pipeline(row mapping) as fast as humanly possible.
- ```ts
- const db = drizzle({ ..., jit: true })
- const query = db.select().from(users).prepare();
- // ^ here drizzle generates a jit mapper which will then be reused during each invocation
- server.get('users', (c) => {
- const users = await query.execute(); // as fast as using raw driver
- return c.json(users)
- })
- ```
- We've reworked internals of Drizzle ORM with the new system of `codecs`. Those are now in charge of normalising responses and requests for diffrent drivers across pg dialect. They helped us not only properly fix a set of data mapping issues but also massively improve performance by not doing unnecessary work.
- We've seen a 25%-30% reduction in latency, while +800rps(14500->15300) in our benchmarks
- Give it a go and let us know if everything works just fine!
- ## Effect v4
- `drizzle-orm@1.0.0-rc.1` comes with native support for Effect v4 via:
- ```ts
- import { PgClient } from '@effect/sql-pg';
- import * as PgDrizzle from 'drizzle-orm/effect-postgres';
- import * as Effect from 'effect/Effect';
- import * as Redacted from 'effect/Redacted';
- import { relations } from '../relations';
- const connectionStr = Redacted.make(process.env['PG_CONNECTION_STRING']!);
- const PgClientLive = PgClient.layer({
- url: connectionStr,
- });
- const DB = PgDrizzle.make({ relations }).pipe(Effect.provide(PgDrizzle.DefaultServices));
- const program = Effect.gen(function*() {
- const db = yield* DB;
- const users = yield* db.select().from(usersTable);
- }).pipe(Effect.provide(PgClientLive));
- await Effect.runPromise(program);
- ```
- ## New Casing API
- ⚠️ BREAKING CHANGE
- In `rc.1` we've finally reworked our legacy casing API of `const db = drizzle({..., casing: "camel" })` which turned out to not be a proper solution, it required duplication in drizzle-orm instantiation and drizzle-kit config and introduced and set of endless bugs all around query builder chain. All of the above is now fixed with new API:
- ```ts
- import * as d from "drizzle-orm/pg-core";
- const users = d.snakeCase.table("users", {
- id: d.serial().primaryKey(),
- email: d.text().unique(),
- fullName: d.text(), // full_name in db
- createdAt: d.timestamp().defaultNow(), // created_at in db
- })
- // --- for namespaces/schemas you can use
- const schema2 = d.camelCase.schema("schema2");
- const usersInSchema2 = schema2.table("users", ...);
- const ordersInSchema2 = schema2.table("orders", ...);
- // ^ all entities in schema2 will be snake_cased
- // --- all available entities
- import { snakeCase, camelCase } from "drizzle-orm/pg-core";
- snakeCase.view
- snakeCase.materializedView
- snakeCase.schema
- snakeCase.table
- camelCase.view
- camelCase.materializedView
- camelCase.schema
- camelCase.table
- ```
- ## New Netlify Database Driver
- > Note: The Netlify Database driver is developed and maintained by the Netlify team.
- **Installation:**
- ```bash
- npm install @netlify/database
- ```
- **Usage example:**
- ```typescript
- import { drizzle } from 'drizzle-orm/netlify-db';
- const db = drizzle();
- const result = await db.execute('select 1');
- ```
- ```typescript
- import { drizzle } from 'drizzle-orm/netlify-db';
- const db = drizzle(process.env.DATABASE_URL);
- const result = await db.execute('select 1');
- ```
- ```typescript
- import { drizzle } from 'drizzle-orm/netlify-db';
- // Explicit client — consumer controls the driver
- const db = drizzle({ client: netlifyDbClient });
- const result = await db.execute('select 1');
- ```
- ## Bug fixes and improvements:
- - Codec system for `postgres` - resolves issues created by differences of data types returned by different drivers or different contexts of query (regular select, JSON object, postgres array). Currently only handles supported by drizzle constructors column types. (fixes #3018, #5090, #5287)
- - Optimized query mappers for `postgres`
- - Opt-in JIT-generated mappers for all dialects
- - Optimized RQBv2 mappers for all dialects
- - ⚠️ BREAKING CHANGE: Removed RQBv1 (`db._query`) from `postgres`
- - Moved pg array utils (`makePgArray`, `parsePgArray`) from `drizzle-orm/pg-core/utils[/array]` to `drizzle-orm/pg-core/array`
- - Simplified `postgres` sessions & prepared queries
- - Fixed `neon-http` `bytea` data corruption
- - Fixed `bun-sql/postgres` timestamp timezone truncation, `json[b]` data double stringification
- - ⚠️ BREAKING CHANGE: Reworked casing API - moved casing control from `db` instance to `table` \ `view` \ `schema` via `import { snakeCase, camelCase } from "drizzle-orm/dialect-core"`, fixed #5112 #5282 #4181 #4209
- - Switched from Effect V3 to Effect V4 beta for `effect-schema`, `effect-postgres` (fixes #5414)