Closed vigneshshettyin closed 4 months ago
Full documentation for this feature can be found in the Prisma Client API Reference.
Note: Because createManyAndReturn()
uses the RETURNING
clause, it is only supported by PostgreSQL, CockroachDB, and SQLite databases. At this time, relationLoadStrategy: join
is not supported in createManyAndReturn()
queries.
Previously, Prisma ORM suffered from performance issues when using the in
operator or when including related models in queries against a MongoDB database. These queries were translated by the Prisma query engine in such a way that indexes were skipped and collection scans were used, leading to slower queries especially on large datasets.
With 5.14.0, Prisma ORM now rewrites queries to use a combination of $or
and $eq
operators, leading to dramatic performance increases for queries that include in
operators or relation loading.
createMany()
should return the created recordstake
on many-to-one relationshipinclude
for relationsfindMany()
query execution with in
include
query slowonDelete: SetNull
prisma init --with-model
@ opentelemetry/*
dependenciesThe required connected records were not found.
when using indicesdbgenerated()
still breaking for Unsupported()
typesshadowDatabaseUrl
is identical to url
(or directUrl
)PRAGMA foreign_key_check;
Curious about all things Prisma? Be sure to check out the Prisma Changelog for updates across Prisma's products, including ORM, Accelerate, and Pulse!
With this release, we are excited to introduce a new Prisma product. We’re calling it “Optimize” because that’s what it does! Let your favorite ORM also help you debug the performance of your application.
Check out our announcement blog post for more details, including a demo video.
Huge thanks to @ pranayat, @ yubrot, @ skyzh, @ anuraaga, @ gutyerrez, @ avallete, @ ceddy4395, @ Kayoshi-dev for helping!
</li>
<li>
<b>5.14.0-integration-static-wasm-worker-loader.5</b> - 2024-05-13
</li>
<li>
<b>5.14.0-integration-static-wasm-worker-loader.4</b> - 2024-05-08
</li>
<li>
<b>5.14.0-integration-static-wasm-worker-loader.3</b> - 2024-04-30
</li>
<li>
<b>5.14.0-integration-static-wasm-worker-loader.2</b> - 2024-04-30
</li>
<li>
<b>5.14.0-integration-static-wasm-worker-loader.1</b> - 2024-04-30
</li>
<li>
<b>5.14.0-integration-schema-files-resolver.10</b> - 2024-05-14
</li>
<li>
<b>5.14.0-integration-schema-files-resolver.9</b> - 2024-05-14
</li>
<li>
<b>5.14.0-integration-schema-files-resolver.8</b> - 2024-05-10
</li>
<li>
<b>5.14.0-integration-schema-files-resolver.7</b> - 2024-05-10
</li>
<li>
<b>5.14.0-integration-schema-files-resolver.6</b> - 2024-05-08
</li>
<li>
<b>5.14.0-integration-schema-files-resolver.5</b> - 2024-05-08
</li>
<li>
<b>5.14.0-integration-schema-files-resolver.4</b> - 2024-05-08
</li>
<li>
<b>5.14.0-integration-schema-files-resolver.3</b> - 2024-05-07
</li>
<li>
<b>5.14.0-integration-schema-files-resolver.2</b> - 2024-05-07
</li>
<li>
<b>5.14.0-integration-schema-files-resolver.1</b> - 2024-05-06
</li>
<li>
<b>5.14.0-integration-engines-5-14-0-26-text-comp-multi-20f7cb6cf71d1ee66be7363748ca983d326e9db1.1</b> - 2024-05-14
</li>
<li>
<b>5.14.0-integration-engines-5-14-0-22-integration-rust-1-78-wasm-fc926224322c04c61c76032c9985a1d4fdfee13f.2</b> - 2024-05-10
</li>
<li>
<b>5.14.0-integration-engines-5-14-0-22-integration-rust-1-78-wasm-fc926224322c04c61c76032c9985a1d4fdfee13f.1</b> - 2024-05-10
</li>
<li>
<b>5.14.0-integration-engines-5-14-0-19-fix-ds-url-rn-03c57ba9ba8eea9dfcf11c5382fdb6822d5aa3d2.1</b> - 2024-05-10
</li>
<li>
<b>5.14.0-integration-engines-5-14-0-10-feat-create-many-and-return-31c187d29db487fb54d6bb593a851d2f9e5687a6.2</b> - 2024-05-02
</li>
<li>
<b>5.14.0-integration-engines-5-14-0-10-feat-create-many-and-return-31c187d29db487fb54d6bb593a851d2f9e5687a6.1</b> - 2024-05-02
</li>
<li>
<b>5.14.0-integration-engines-5-14-0-1-integration-vitess-constraint-fix-ca251465b6b966a5b9f61c3a8077ef99275ca330.2</b> - 2024-04-23
</li>
<li>
<b>5.14.0-integration-engines-5-14-0-1-integration-vitess-constraint-fix-ca251465b6b966a5b9f61c3a8077ef99275ca330.1</b> - 2024-04-23
</li>
<li>
<b>5.14.0-dev.77</b> - 2024-05-14
</li>
<li>
<b>5.14.0-dev.76</b> - 2024-05-13
</li>
<li>
<b>5.14.0-dev.75</b> - 2024-05-13
</li>
<li>
<b>5.14.0-dev.74</b> - 2024-05-13
</li>
<li>
<b>5.14.0-dev.72</b> - 2024-05-13
</li>
<li>
<b>5.14.0-dev.71</b> - 2024-05-13
</li>
<li>
<b>5.14.0-dev.70</b> - 2024-05-13
</li>
<li>
<b>5.14.0-dev.69</b> - 2024-05-13
</li>
<li>
<b>5.14.0-dev.68</b> - 2024-05-13
</li>
<li>
<b>5.14.0-dev.67</b> - 2024-05-10
</li>
<li>
<b>5.14.0-dev.66</b> - 2024-05-10
</li>
<li>
<b>5.14.0-dev.65</b> - 2024-05-08
</li>
<li>
<b>5.14.0-dev.64</b> - 2024-05-08
</li>
<li>
<b>5.14.0-dev.63</b> - 2024-05-08
</li>
<li>
<b>5.14.0-dev.62</b> - 2024-05-08
</li>
<li>
<b>5.14.0-dev.61</b> - 2024-05-08
</li>
<li>
<b>5.14.0-dev.60</b> - 2024-05-08
</li>
<li>
<b>5.14.0-dev.59</b> - 2024-05-08
</li>
<li>
<b>5.14.0-dev.58</b> - 2024-05-08
</li>
<li>
<b>5.14.0-dev.57</b> - 2024-05-08
</li>
<li>
<b>5.14.0-dev.56</b> - 2024-05-08
</li>
<li>
<b>5.14.0-dev.55</b> - 2024-05-08
</li>
<li>
<b>5.14.0-dev.54</b> - 2024-05-07
</li>
<li>
<b>5.14.0-dev.53</b> - 2024-05-07
</li>
<li>
<b>5.14.0-dev.52</b> - 2024-05-07
</li>
<li>
<b>5.14.0-dev.51</b> - 2024-05-06
</li>
<li>
<b>5.14.0-dev.50</b> - 2024-05-06
</li>
<li>
<b>5.14.0-dev.49</b> - 2024-05-06
</li>
<li>
<b>5.14.0-dev.48</b> - 2024-05-03
</li>
<li>
<b>5.14.0-dev.47</b> - 2024-05-03
</li>
<li>
<b>5.14.0-dev.46</b> - 2024-05-02
</li>
<li>
<b>5.14.0-dev.44</b> - 2024-05-02
</li>
<li>
<b>5.14.0-dev.43</b> - 2024-05-02
</li>
<li>
<b>5.14.0-dev.42</b> - 2024-05-02
</li>
<li>
<b>5.14.0-dev.41</b> - 2024-05-02
</li>
<li>
<b>5.14.0-dev.40</b> - 2024-05-02
</li>
<li>
<b>5.14.0-dev.39</b> - 2024-05-02
</li>
<li>
<b>5.14.0-dev.38</b> - 2024-05-02
</li>
<li>
<b>5.14.0-dev.36</b> - 2024-05-02
</li>
<li>
<b>5.14.0-dev.35</b> - 2024-05-01
</li>
<li>
<b>5.14.0-dev.34</b> - 2024-04-30
</li>
<li>
<b>5.14.0-dev.33</b> - 2024-04-30
</li>
<li>
<b>5.14.0-dev.32</b> - 2024-04-30
</li>
<li>
<b>5.14.0-dev.31</b> - 2024-04-30
</li>
<li>
<b>5.14.0-dev.30</b> - 2024-04-30
</li>
<li>
<b>5.14.0-dev.28</b> - 2024-04-30
</li>
<li>
<b>5.14.0-dev.27</b> - 2024-04-30
</li>
<li>
<b>5.14.0-dev.26</b> - 2024-04-30
</li>
<li>
<b>5.14.0-dev.25</b> - 2024-04-30
</li>
<li>
<b>5.14.0-dev.24</b> - 2024-04-30
</li>
<li>
<b>5.14.0-dev.23</b> - 2024-04-29
</li>
<li>
<b>5.14.0-dev.22</b> - 2024-04-26
</li>
<li>
<b>5.14.0-dev.21</b> - 2024-04-26
</li>
<li>
<b>5.14.0-dev.20</b> - 2024-04-26
</li>
<li>
<b>5.14.0-dev.19</b> - 2024-04-26
</li>
<li>
<b>5.14.0-dev.18</b> - 2024-04-26
</li>
<li>
<b>5.14.0-dev.16</b> - 2024-04-25
</li>
<li>
<b>5.14.0-dev.14</b> - 2024-04-25
</li>
<li>
<b>5.14.0-dev.13</b> - 2024-04-25
</li>
<li>
<b>5.14.0-dev.12</b> - 2024-04-24
</li>
<li>
<b>5.14.0-dev.11</b> - 2024-04-24
</li>
<li>
<b>5.14.0-dev.9</b> - 2024-04-24
</li>
<li>
<b>5.14.0-dev.6</b> - 2024-04-24
</li>
<li>
<b>5.14.0-dev.5</b> - 2024-04-24
</li>
<li>
<b>5.14.0-dev.4</b> - 2024-04-24
</li>
<li>
<b>5.14.0-dev.3</b> - 2024-04-24
</li>
<li>
<b>5.14.0-dev.2</b> - 2024-04-24
</li>
<li>
<b>5.14.0-dev.1</b> - 2024-04-24
</li>
<li>
<b>5.13.0</b> - <a href="https://github.com/prisma/prisma/releases/tag/5.13.0">2024-04-23</a></br><p>Today, we are excited to share the <code>5.13.0</code> stable release 🎉</p>
🌟 Help us spread the word about Prisma by starring the repo or posting on X about the release.
omit
fields from Prisma Client queries (Preview)We’re excited to announce Preview support for the omit
option within the Prisma Client query options. The highly-requested omit
feature now allows you to exclude fields that you don’t want to retrieve from the database on a per-query basis.
By default, when a query returns records, the result includes all scalar fields of the models defined in the Prisma schema. select
can be used to return specific fields, while omit
can now be used to exclude specific fields. omit
lives at the same API level and works on all of the same Prisma Client model queries as select
. Note, however, that omit
and select
are mutually exclusive. In other words, you can’t use both in the same query.
To get started using omit
, enable the omitApi
Preview feature in your Prisma schema:
// schema.prisma
generator client {
provider = "prisma-client-js"
previewFeatures = ["omitApi"]
}
Be sure to re-generate Prisma Client afterwards:
npx prisma generate
Here is an example of using omit
:
// Includes all fields except password
await prisma.user.findMany({
omit: {
password: true
},
})
Here is an example of using omit
with include
:
// Includes all user fields except user's password and title of user's posts
await prisma.user.findMany({
omit: {
password: true
},
include: {
posts: {
omit: {
title: true
},
},
},
})
model User {
id Int @ id @ default(autoincrement())
email String @ unique
name String?
password String
posts Post[]
}
model Post {
id Int @ id @ default(autoincrement())
title String
author User @ relation(fields: [authorId], references: [id])
authorId Int
}
Many users have requested a global implementation of omit
. This request will be accommodated in the future. In the meantime, you can follow the issue here.
📣 Share your feedback: omitApi
Preview feature
📚 Documentation: omit
- Prisma Client API Reference
upsert()
: Internal error: Attempted to serialize empty result.
upsert()
fails with "Attempted to serialize empty result."upsert()
: Internal error: Attempted to serialize empty result.
upsert()
: Internal error: Attempted to serialize empty result.
upsert()
: Internal error: Attempted to serialize empty result.
upsert()
: Internal error: Attempted to serialize empty result
upsert()
: Internal error: Attempted to serialize empty result.
Internal error: Attempted to serialize empty result.
on upsert()
for update
case in different databases (when using relationMode=prisma
explicitly or implicitly [MongoDB])upsert(): Internal error: Attempted to serialize empty result
when relationMode = "prisma"
is used✘ [ERROR] near "��": syntax error at offset 0
when running wrangler d1 migrations apply
with Prisma generated migration (on Windows, using Powershell)Huge thanks to @ ospfranco, @ pranayat, @ yubrot, @ skyzh, @ anuraaga, @ yehonatanz, @ arthurfiorette, @ elithrar, @ tockn, @ Kuhave, @ obiwac for helping!
</li>
</ul>
from <a href="https://github.com/prisma/prisma/releases">@prisma/client GitHub release notes</a>
[!IMPORTANT]
- Check the changes in this PR to ensure they won't cause issues with your project.
- This PR was automatically created by Snyk using the credentials of a real user.
Note: You are seeing this because you or someone else with access to this repository has authorized Snyk to open upgrade PRs.
For more information:
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Comments | Updated (UTC) |
---|---|---|---|---|
eat-my-url | ✅ Ready (Inspect) | Visit Preview | 💬 Add feedback | Jun 5, 2024 1:05am |
This PR was automatically created by Snyk using the credentials of a real user.
![snyk-top-banner](https://github.com/andygongea/OWASP-Benchmark/assets/818805/c518c423-16fe-447e-b67f-ad5a49b5d123)
Snyk has created this PR to upgrade @prisma/client from 5.13.0 to 5.14.0.
:information_source: Keep your dependencies up-to-date. This makes it easier to fix existing vulnerabilities and to more quickly identify and fix newly disclosed vulnerabilities when they affect your project.- The recommended version is **92 versions** ahead of your current version. - The recommended version was released on **22 days ago**.
Release notes
Package name: @prisma/client
Today, we are excited to share the
5.14.0
stable release 🎉🌟 Help us spread the word about Prisma by starring the repo ☝️ or posting on X about the release. 🌟
Highlights
Share your feedback about Prisma ORM
We want to know how you like working with Prisma ORM in your projects! Please take our 2min survey and let us know what you like or where we can improve 🙏
createManyAndReturn()
We’re happy to announce the availability of a new, top-level Prisma Client query:
createManyAndReturn()
. It works similarly tocreateMany()
but uses aRETURNING
clause in the SQL query to retrieve the records that were just created.Here’s an example of creating multiple posts and then immediately returning those posts.
<div class="highlight highlight-source-tsx notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="const postBodies = req.json()['posts']
const posts = prisma.post.createManyAndReturn({ data: postBodies });
return posts">
Additionally,
createManyAndReturn()
supports the same options asfindMany()
, such as the ability to return only specific fields.<div class="highlight highlight-source-tsx notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="const postBodies = req.json()['posts']
const postTitles = prisma.post.createManyAndReturn({ data: postBodies, select: { title: true, }, });
return postTitles">