drizzle-team/drizzle-orm (drizzle-orm)
### [`v0.30.10`](https://togithub.com/drizzle-team/drizzle-orm/releases/tag/0.30.10)
[Compare Source](https://togithub.com/drizzle-team/drizzle-orm/compare/0.30.9...0.30.10)
#### New Features
##### š `.if()` function added to all WHERE expressions
##### Select all users after cursors if a cursor value was provided
```ts
function getUsersAfter(cursor?: number) {
return db.select().from(users).where(
gt(users.id, cursor).if(cursor)
);
}
```
#### Bug Fixes
- Fixed internal mappings for sessions `.all`, `.values`, `.execute` functions in AWS DataAPI
### [`v0.30.9`](https://togithub.com/drizzle-team/drizzle-orm/releases/tag/0.30.9)
[Compare Source](https://togithub.com/drizzle-team/drizzle-orm/compare/0.30.8...0.30.9)
- š Fixed migrator in AWS Data API
- Added `setWhere` and `targetWhere` fields to `.onConflictDoUpdate()` config in SQLite instead of single `where` field
- š ļø Added schema information to Drizzle instances via `db._.fullSchema`
### [`v0.30.8`](https://togithub.com/drizzle-team/drizzle-orm/releases/tag/0.30.8)
[Compare Source](https://togithub.com/drizzle-team/drizzle-orm/compare/0.30.7...0.30.8)
- š Added custom schema support to enums in Postgres (fixes [#669](https://togithub.com/drizzle-team/drizzle-orm/issues/669) via [#2048](https://togithub.com/drizzle-team/drizzle-orm/issues/2048)):
> :warning: **Only available in `drizzle-orm` for now, `drizzle-kit` support will arrive soon**
```ts
import { pgSchema } from 'drizzle-orm/pg-core';
const mySchema = pgSchema('mySchema');
const colors = mySchema.enum('colors', ['red', 'green', 'blue']);
```
- š Changed D1 `migrate()` function to use batch API ([#2137](https://togithub.com/drizzle-team/drizzle-orm/issues/2137))
- š Split `where` clause in Postgres `.onConflictDoUpdate` method into `setWhere` and `targetWhere` clauses, to support both `where` cases in `on conflict ...` clause (fixes [#1628](https://togithub.com/drizzle-team/drizzle-orm/issues/1628), [#1302](https://togithub.com/drizzle-team/drizzle-orm/issues/1302) via [#2056](https://togithub.com/drizzle-team/drizzle-orm/issues/2056))
- š Fixed query generation for `where` clause in Postgres `.onConflictDoNothing` method, as it was placed in a wrong spot (fixes [#1628](https://togithub.com/drizzle-team/drizzle-orm/issues/1628) via [#2056](https://togithub.com/drizzle-team/drizzle-orm/issues/2056))
- š Fixed multiple issues with AWS Data API driver (fixes [#1931](https://togithub.com/drizzle-team/drizzle-orm/issues/1931), [#1932](https://togithub.com/drizzle-team/drizzle-orm/issues/1932), [#1934](https://togithub.com/drizzle-team/drizzle-orm/issues/1934), [#1936](https://togithub.com/drizzle-team/drizzle-orm/issues/1936) via [#2119](https://togithub.com/drizzle-team/drizzle-orm/issues/2119))
- š Fix inserting and updating array values in AWS Data API (fixes [#1912](https://togithub.com/drizzle-team/drizzle-orm/issues/1912) via [#1911](https://togithub.com/drizzle-team/drizzle-orm/issues/1911))
Thanks [@hugo082](https://togithub.com/hugo082) and [@livingforjesus](https://togithub.com/livingforjesus)!
### [`v0.30.7`](https://togithub.com/drizzle-team/drizzle-orm/releases/tag/0.30.7)
[Compare Source](https://togithub.com/drizzle-team/drizzle-orm/compare/0.30.6...0.30.7)
##### Bug fixes
- Add mappings for `@vercel/postgres` package
- Fix interval mapping for `neon` drivers - [#1542](https://togithub.com/drizzle-team/drizzle-orm/issues/1542)
### [`v0.30.6`](https://togithub.com/drizzle-team/drizzle-orm/releases/tag/0.30.6)
[Compare Source](https://togithub.com/drizzle-team/drizzle-orm/compare/0.30.5...0.30.6)
#### New Features
##### š PGlite driver Support
PGlite is a WASM Postgres build packaged into a TypeScript client library that enables you to run Postgres in the browser, Node.js and Bun, with no need to install any other dependencies. It is only 2.6mb gzipped.
It can be used as an ephemeral in-memory database, or with persistence either to the file system (Node/Bun) or indexedDB (Browser).
Unlike previous "Postgres in the browser" projects, PGlite does not use a Linux virtual machine - it is simply Postgres in WASM.
Usage Example
```ts
import { PGlite } from '@electric-sql/pglite';
import { drizzle } from 'drizzle-orm/pglite';
// In-memory Postgres
const client = new PGlite();
const db = drizzle(client);
await db.select().from(users);
```
***
There are currently 2 limitations, that should be fixed on Pglite side:
- [Attempting to refresh a materialised view throws error](https://togithub.com/electric-sql/pglite/issues/63)
- [Attempting to SET TIME ZONE throws error](https://togithub.com/electric-sql/pglite/issues/62)
### [`v0.30.5`](https://togithub.com/drizzle-team/drizzle-orm/releases/tag/0.30.5)
[Compare Source](https://togithub.com/drizzle-team/drizzle-orm/compare/0.30.4...0.30.5)
#### New Features
##### š `$onUpdate` functionality for PostgreSQL, MySQL and SQLite
Adds a dynamic update value to the column.
The function will be called when the row is updated, and the returned value will be used as the column value if none is provided.
If no `default` (or `$defaultFn`) value is provided, the function will be called when the row is inserted as well, and the returned value will be used as the column value.
> Note: This value does not affect the `drizzle-kit` behavior, it is only used at runtime in `drizzle-orm`.
```ts
const usersOnUpdate = pgTable('users_on_update', {
id: serial('id').primaryKey(),
name: text('name').notNull(),
updateCounter: integer('update_counter').default(sql`1`).$onUpdateFn(() => sql`update_counter + 1`),
updatedAt: timestamp('updated_at', { mode: 'date', precision: 3 }).$onUpdate(() => new Date()),
alwaysNull: text('always_null').$type().$onUpdate(() => null),
});
```
#### Fixes
- \[BUG]: insertions on columns with the smallserial datatype are not optional - [#1848](https://togithub.com/drizzle-team/drizzle-orm/issues/1848)
Thanks [@Angelelz](https://togithub.com/Angelelz) and [@gabrielDonnantuoni](https://togithub.com/gabrielDonnantuoni)!
Configuration
š Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
š¦ Automerge: Disabled by config. Please merge this manually once you are satisfied.
ā» Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
š Ignore: Close this PR and you won't be reminded about this update again.
[ ] If you want to rebase/retry this PR, check this box
This PR has been generated by Mend Renovate. View repository job log here.
This PR contains the following updates:
0.30.4
->0.30.10
Release Notes
drizzle-team/drizzle-orm (drizzle-orm)
### [`v0.30.10`](https://togithub.com/drizzle-team/drizzle-orm/releases/tag/0.30.10) [Compare Source](https://togithub.com/drizzle-team/drizzle-orm/compare/0.30.9...0.30.10) #### New Features ##### š `.if()` function added to all WHERE expressions ##### Select all users after cursors if a cursor value was provided ```ts function getUsersAfter(cursor?: number) { return db.select().from(users).where( gt(users.id, cursor).if(cursor) ); } ``` #### Bug Fixes - Fixed internal mappings for sessions `.all`, `.values`, `.execute` functions in AWS DataAPI ### [`v0.30.9`](https://togithub.com/drizzle-team/drizzle-orm/releases/tag/0.30.9) [Compare Source](https://togithub.com/drizzle-team/drizzle-orm/compare/0.30.8...0.30.9) - š Fixed migrator in AWS Data API - Added `setWhere` and `targetWhere` fields to `.onConflictDoUpdate()` config in SQLite instead of single `where` field - š ļø Added schema information to Drizzle instances via `db._.fullSchema` ### [`v0.30.8`](https://togithub.com/drizzle-team/drizzle-orm/releases/tag/0.30.8) [Compare Source](https://togithub.com/drizzle-team/drizzle-orm/compare/0.30.7...0.30.8) - š Added custom schema support to enums in Postgres (fixes [#669](https://togithub.com/drizzle-team/drizzle-orm/issues/669) via [#2048](https://togithub.com/drizzle-team/drizzle-orm/issues/2048)): > :warning: **Only available in `drizzle-orm` for now, `drizzle-kit` support will arrive soon** ```ts import { pgSchema } from 'drizzle-orm/pg-core'; const mySchema = pgSchema('mySchema'); const colors = mySchema.enum('colors', ['red', 'green', 'blue']); ``` - š Changed D1 `migrate()` function to use batch API ([#2137](https://togithub.com/drizzle-team/drizzle-orm/issues/2137)) - š Split `where` clause in Postgres `.onConflictDoUpdate` method into `setWhere` and `targetWhere` clauses, to support both `where` cases in `on conflict ...` clause (fixes [#1628](https://togithub.com/drizzle-team/drizzle-orm/issues/1628), [#1302](https://togithub.com/drizzle-team/drizzle-orm/issues/1302) via [#2056](https://togithub.com/drizzle-team/drizzle-orm/issues/2056)) - š Fixed query generation for `where` clause in Postgres `.onConflictDoNothing` method, as it was placed in a wrong spot (fixes [#1628](https://togithub.com/drizzle-team/drizzle-orm/issues/1628) via [#2056](https://togithub.com/drizzle-team/drizzle-orm/issues/2056)) - š Fixed multiple issues with AWS Data API driver (fixes [#1931](https://togithub.com/drizzle-team/drizzle-orm/issues/1931), [#1932](https://togithub.com/drizzle-team/drizzle-orm/issues/1932), [#1934](https://togithub.com/drizzle-team/drizzle-orm/issues/1934), [#1936](https://togithub.com/drizzle-team/drizzle-orm/issues/1936) via [#2119](https://togithub.com/drizzle-team/drizzle-orm/issues/2119)) - š Fix inserting and updating array values in AWS Data API (fixes [#1912](https://togithub.com/drizzle-team/drizzle-orm/issues/1912) via [#1911](https://togithub.com/drizzle-team/drizzle-orm/issues/1911)) Thanks [@hugo082](https://togithub.com/hugo082) and [@livingforjesus](https://togithub.com/livingforjesus)! ### [`v0.30.7`](https://togithub.com/drizzle-team/drizzle-orm/releases/tag/0.30.7) [Compare Source](https://togithub.com/drizzle-team/drizzle-orm/compare/0.30.6...0.30.7) ##### Bug fixes - Add mappings for `@vercel/postgres` package - Fix interval mapping for `neon` drivers - [#1542](https://togithub.com/drizzle-team/drizzle-orm/issues/1542) ### [`v0.30.6`](https://togithub.com/drizzle-team/drizzle-orm/releases/tag/0.30.6) [Compare Source](https://togithub.com/drizzle-team/drizzle-orm/compare/0.30.5...0.30.6) #### New Features ##### š PGlite driver Support PGlite is a WASM Postgres build packaged into a TypeScript client library that enables you to run Postgres in the browser, Node.js and Bun, with no need to install any other dependencies. It is only 2.6mb gzipped. It can be used as an ephemeral in-memory database, or with persistence either to the file system (Node/Bun) or indexedDB (Browser). Unlike previous "Postgres in the browser" projects, PGlite does not use a Linux virtual machine - it is simply Postgres in WASM. Usage Example ```ts import { PGlite } from '@electric-sql/pglite'; import { drizzle } from 'drizzle-orm/pglite'; // In-memory Postgres const client = new PGlite(); const db = drizzle(client); await db.select().from(users); ``` *** There are currently 2 limitations, that should be fixed on Pglite side: - [Attempting to refresh a materialised view throws error](https://togithub.com/electric-sql/pglite/issues/63) - [Attempting to SET TIME ZONE throws error](https://togithub.com/electric-sql/pglite/issues/62) ### [`v0.30.5`](https://togithub.com/drizzle-team/drizzle-orm/releases/tag/0.30.5) [Compare Source](https://togithub.com/drizzle-team/drizzle-orm/compare/0.30.4...0.30.5) #### New Features ##### š `$onUpdate` functionality for PostgreSQL, MySQL and SQLite Adds a dynamic update value to the column. The function will be called when the row is updated, and the returned value will be used as the column value if none is provided. If no `default` (or `$defaultFn`) value is provided, the function will be called when the row is inserted as well, and the returned value will be used as the column value. > Note: This value does not affect the `drizzle-kit` behavior, it is only used at runtime in `drizzle-orm`. ```ts const usersOnUpdate = pgTable('users_on_update', { id: serial('id').primaryKey(), name: text('name').notNull(), updateCounter: integer('update_counter').default(sql`1`).$onUpdateFn(() => sql`update_counter + 1`), updatedAt: timestamp('updated_at', { mode: 'date', precision: 3 }).$onUpdate(() => new Date()), alwaysNull: text('always_null').$typeConfiguration
š Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
š¦ Automerge: Disabled by config. Please merge this manually once you are satisfied.
ā» Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
š Ignore: Close this PR and you won't be reminded about this update again.
This PR has been generated by Mend Renovate. View repository job log here.