-
Notifications
You must be signed in to change notification settings - Fork 783
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into current_time
- Loading branch information
Showing
100 changed files
with
3,766 additions
and
5,680 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
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
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
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
10 changes: 6 additions & 4 deletions
10
...-client/000-setup-and-configuration/050-databases-connections/200-pgbouncer.mdx
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -681,7 +681,6 @@ const updateUsers = await prisma.user.updateMany({ | |
}, | ||
}) | ||
``` | ||
|
||
</cmd> | ||
<cmdResult> | ||
|
||
|
@@ -694,6 +693,62 @@ const updateUsers = await prisma.user.updateMany({ | |
</cmdResult> | ||
</CodeWithResult> | ||
|
||
### Update and return multiple records | ||
|
||
:::info | ||
|
||
This feature is available in Prisma ORM version 6.2.0 and later for PostgreSQL, CockroachDB, and SQLite. | ||
|
||
::: | ||
|
||
You can use `updateManyAndReturn()` in order to update many records and return the resulting objects. | ||
|
||
<CodeWithResult outputResultText="query"> | ||
<cmd> | ||
|
||
```ts | ||
const users = await prisma.user.updateManyAndReturn({ | ||
where: { | ||
email: { | ||
contains: 'prisma.io', | ||
} | ||
}, | ||
data: { | ||
role: 'ADMIN' | ||
} | ||
}) | ||
``` | ||
|
||
</cmd> | ||
<cmdResult> | ||
|
||
```js no-copy | ||
[{ | ||
id: 22, | ||
name: 'Alice', | ||
email: '[email protected]', | ||
profileViews: 0, | ||
role: 'ADMIN', | ||
coinflips: [] | ||
}, { | ||
id: 23, | ||
name: 'Bob', | ||
email: '[email protected]', | ||
profileViews: 0, | ||
role: 'ADMIN', | ||
coinflips: [] | ||
}] | ||
``` | ||
|
||
</cmdResult> | ||
</CodeWithResult> | ||
|
||
:::warning | ||
|
||
`relationLoadStrategy: join` is not available when using `updateManyAndReturn()`. | ||
|
||
::: | ||
|
||
### Update _or_ create records | ||
|
||
The following query uses [`upsert()`](/orm/reference/prisma-client-reference#upsert) to update a `User` record with a specific email address, or create that `User` record if it does not exist: | ||
|
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.