Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update soft delete middleware docs about findFirstOrThrow and findUniqueOrThrow #5392

Conversation

Kwontaehwon
Copy link
Contributor

Describe this PR

While working on my project and referring to the official docs, I used a soft delete middleware and started using findFirstOrThrow and findUniqueOrThrow. However, I noticed that these two queries can't apply soft delete.

At that time, the prisma/client version I was using missed the prismaAction type for findFirstOrThrow and findUniqueOrThrow, preventing me from applying this feature.

However, through prisma/prisma#17471,
these two queries were added to the prismaAction type in prisma/client version 5.1.0.

Currently, there is no information related to this in the soft delete documentation.
https://www.prisma.io/docs/concepts/components/prisma-client/middleware/soft-delete-middleware#option-2-use-middleware-to-determine-the-behavior-of-readupdate-queries-for-deleted-records

Therefore, we should add information regarding how to enable soft delete middleware with findFirstOrThrow and findUniqueOrThrow from Prisma/client version 5.1.0 onwards.

Changes

  • Add information about soft delete middleware with findFirstOrThrow and findUniqueOrThrow is available after 5.1.0 version.

What issue does this fix?

Fixes #5391

Any other relevant information

@vercel
Copy link

vercel bot commented Oct 23, 2023

@Kwontaehwon is attempting to deploy a commit to the Prisma Team on Vercel.

A member of the Team first needs to authorize it.

@janpio
Copy link
Contributor

janpio commented Oct 27, 2023

Should we also update the example on the page to cover these then?

@Kwontaehwon
Copy link
Contributor Author

Kwontaehwon commented Nov 2, 2023

Should we also update the example on the page to cover these then?

@janpio Thanks for review! I changed example code to support findFirstOrThrow and findUniqueOrThrow. I also add test about it.

@janpio janpio requested review from jharrell and ruheni November 2, 2023 12:32
Copy link

vercel bot commented Nov 2, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 3, 2023 2:52pm

@jharrell
Copy link
Member

jharrell commented Nov 2, 2023

Thank you very much for the contribution @Kwontaehwon ! I'm running our test suite to confirm that everything looks good and then will get this merged.

@Kwontaehwon
Copy link
Contributor Author

@jharrell It seems like something went wrong during the distribution process. This is my first contribution so I don't know what to do. What should I do?

@jharrell
Copy link
Member

@Kwontaehwon that's an issue on our side. Everything looks good and I'm merging. Thank you again for your contribution!

@jharrell jharrell merged commit 65273f7 into prisma:main Nov 13, 2023
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update soft delete middleware docs about findFirstOrThrow and findUniqueOrThrow
3 participants