Replies: 20 comments 20 replies
-
|
I find this feature useful for cases like where clauses, but I think it's way too strong for update pattern where it's common for an API to expose an endpoint schema like |
Beta Was this translation helpful? Give feedback.
-
|
I wish there was an alternative to Also, the example for skipping says |
Beta Was this translation helpful? Give feedback.
-
|
I'm going to repost this comment from the original issue: #20169 (comment)
I have the exact same situation, we are 100% comfortable using undefined to manage the operations, it's using zod to validate inputs and some of the attributes are going to be undefined... gave a try setting the For new major release I'm ok to be a default a option, but it must be configurable to allow a painless-migration. |
Beta Was this translation helpful? Give feedback.
-
|
This is great. I was previously doing that manually by extending $allOperations and checking if any property in the where statement was undefined as a safety net. Only thing, would it be possible to export the Skip type so I can use it in a variable in my application. Would use it this way:
for now I'm doing this instead:
which is a bit annoying Thanks |
Beta Was this translation helpful? Give feedback.
-
|
I think this is a step in the right direction, skipping the condition entirely was really unintuitive behaviour. But there are still cases where you WANT to pass in undefined and receive no results back. A use case with I have a case where the input can be const vehicle = await this.prismaService.vehicle.findFirst({
where: { id: vehicleId },
});If there is no |
Beta Was this translation helpful? Give feedback.
-
|
Is it possible to disable generation of the Skip type entirely? It makes it difficult to use the generated types as 'normal' objects. const input: Prisma.ItemUncheckedCreateInput = {}
// ...
input.line = input.line?.replaceAll("-", "") || null
// ^^^ Property 'replaceAll' does not exist on type 'string | Skip'. |
Beta Was this translation helpful? Give feedback.
-
|
Prisma.skip should work for take,skip,orderBy and OR/AND clauses as well❤️ |
Beta Was this translation helpful? Give feedback.
-
|
I've had one problem with For example: const data = await prisma.model.findMany({
cursor: hasCursor ? { /* provided cursor info */ } : Prisma.skip,
}); |
Beta Was this translation helpful? Give feedback.
-
|
"strictUndefinedChecks is a change to Prisma Client which disallows undefined values in Prisma Client queries" – that's very nice, but I'm pretty sure that this check should not apply to the content of JSON fields. |
Beta Was this translation helpful? Give feedback.
-
|
This is a great addition for safety. Not only for deletes, but even when fetching records for the user, it may return all records for the user unintendedly. I just want to make sure though, this will only be enforced for the |
Beta Was this translation helpful? Give feedback.
-
|
The change is great. If there was a way to skip it (pun intended) for update/create queries it would be perfect. |
Beta Was this translation helpful? Give feedback.
-
|
I agree with another commenter that we should be able to enable this for where clauses only if so desired. My main concern when looking for something like this is to prevent accidental data loss. This is something that could affect all rows in a table and it would be great for Prisma to have protections from that. |
Beta Was this translation helpful? Give feedback.
-
|
A quick update: we're currently evaluating whether / how to proceed with this preview feature. We’ll publish an updated plan later this year. Read more here: #26136 |
Beta Was this translation helpful? Give feedback.
-
|
I wanted to add some thoughts here after migrating our codebase to use
|
Beta Was this translation helpful? Give feedback.
-
|
TLDR:
Full text:
Would it be appropriate to file an issue against the documentation? |
Beta Was this translation helpful? Give feedback.
-
|
this new preview feature is a step in the right direction and I am very happy to see it in preview. However, I do have some issues with its implementation: I ran into a bug today because of this, typescript doesnt detect the issue, at all. Opening up alot of doors to run time errors. dashboard:dev: → 283 await __TURBOPACK__imported__module__$5b$project$5d2f$apps$2f$dashboard$2f$src$2f$server$2f$db$2e$ts__$5b$app$2d$route$5d$__$28$ecmascript$29$__["db"].account.update({
dashboard:dev: where: {
dashboard:dev: id: "123"
dashboard:dev: },
dashboard:dev: data: {
dashboard:dev: access_token: "123",
dashboard:dev: refresh_token: "123",
dashboard:dev: user: {
dashboard:dev: update: {
dashboard:dev: name: "123",
dashboard:dev: image: undefined,
dashboard:dev: ~~~~~~~~~
dashboard:dev: email: "123@gmail.com"
dashboard:dev: }
dashboard:dev: },
dashboard:dev: updatedAt: new Date("2025-03-03T16:49:24.928Z")
dashboard:dev: }
dashboard:dev: })
dashboard:dev:
dashboard:dev: Invalid value for argument `update`: explicitly `undefined` values are not allowed.User model showing model User {
id String @id @default(cuid())
name String?
email String? @unique
emailVerified DateTime?
image String?I think the best solution would be for the strict undefined check to only be done in where clauses, not in the actual data for the row creation. |
Beta Was this translation helpful? Give feedback.
-
|
Hello, I want to ask if this will be enforced later (eg: prisma 7) or if this gonna be facultative even after preview. |
Beta Was this translation helpful? Give feedback.
-
|
Is this enabled by default in v6? The thread and docs give conflicting info. Also, this must be a compile-time error not runtime. In large enterprise apps, runtime errors like this are nearly impossible to catch. If this becomes the default, there needs to be an opt-out to avoid surprise bugs during future upgrades. This is painful although I fully agree with the intent of the feature. Is there any hope this can be a compile-time error? |
Beta Was this translation helpful? Give feedback.
-
|
Is this enabled in v6? As above the 5.22 release notes imply it would be but there's nothing in the 6 release notes. |
Beta Was this translation helpful? Give feedback.
-
|
Anybody know how this feature interacts with where clauses in upsert operations? |
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
strictUndefinedChecksis a change to Prisma Client which disallowsundefinedvalues in Prisma Client queries. This feature is a direct result of this issue.Documentation: https://www.prisma.io/docs/orm/prisma-client/special-fields-and-types/null-and-undefined#strict-undefined-checks-preview-feature
Please share your feedback about
strictUndefinedChecks(released in v5.20.0 of Prisma ORM) in this discussion.If you encounter a bug, please open a bug report in this repository.
If the feature is working well for you, please share so in a comment below or leave a 👍 on this discussion.
Need help or have questions? Join the Prisma Discord community and ask away! We're here to support you.
Beta Was this translation helpful? Give feedback.
All reactions