-
-
Notifications
You must be signed in to change notification settings - Fork 688
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2119 from drizzle-team/aws-data-api-fixes
AWS Data API fixes
- Loading branch information
Showing
35 changed files
with
7,681 additions
and
2,393 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,25 @@ | ||
- 🎉 Added custom schema support to enums in Postgres: | ||
## New Features | ||
|
||
```ts | ||
import { pgSchema } from 'drizzle-orm/pg-core'; | ||
### 🎉 `$onUpdate` functionality for PostgreSQL, MySQL and SQLite | ||
|
||
const mySchema = pgSchema('mySchema'); | ||
const colors = mySchema.enum('colors', ['red', 'green', 'blue']); | ||
``` | ||
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. | ||
|
||
- 🐛 Split `where` clause in Postgres `.onConflictDoUpdate` method into `setWhere` and `targetWhere` clauses, to support both `where` cases in `on conflict ...` clause (#1628, #1302) | ||
- 🐛 Fix query generation for `where` clause in Postgres `.onConflictDoNothing` method, as it was placed in a wrong spot (#1628) | ||
> 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<string | null>().$onUpdate(() => null), | ||
}); | ||
``` | ||
|
||
## Fixes | ||
|
||
- [BUG]: insertions on columns with the smallserial datatype are not optional - #1848 | ||
|
||
Thanks @Angelelz and @gabrielDonnantuoni! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
## 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://github.com/electric-sql/pglite/issues/63) | ||
|
||
- [Attempting to SET TIME ZONE throws error](https://github.com/electric-sql/pglite/issues/62) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
## Bug fixes | ||
|
||
- Add mappings for `@vercel/postgres` package | ||
- Fix interval mapping for `neon` drivers - #1542 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
- 🎉 Added custom schema support to enums in Postgres: | ||
|
||
```ts | ||
import { pgSchema } from 'drizzle-orm/pg-core'; | ||
|
||
const mySchema = pgSchema('mySchema'); | ||
const colors = mySchema.enum('colors', ['red', 'green', 'blue']); | ||
``` | ||
|
||
- 🐛 Split `where` clause in Postgres `.onConflictDoUpdate` method into `setWhere` and `targetWhere` clauses, to support both `where` cases in `on conflict ...` clause (#1628, #1302) | ||
- 🐛 Fix query generation for `where` clause in Postgres `.onConflictDoNothing` method, as it was placed in a wrong spot (#1628) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.