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

Make clearer that soft delete middleware is just a proof of concept, not our soft delete solution #2508

Closed
janpio opened this issue Nov 15, 2021 · 4 comments · Fixed by #3763
Assignees
Labels
docs Documentation creation, updates or corrections

Comments

@janpio
Copy link
Member

janpio commented Nov 15, 2021

Update: 5-Sep-2022, Andrew W
I'm investigating, but my first instinct is that we should signpost this in the page title - something like "Middleware example: soft delete" and then put an admonition saying something like "This is an example of what you can do with middleware - it is not the official soft delete in Prisma". If we do that, we'll also need to make equivalent changes to the other middleware examples pages, for uniformity's sake.

https://www.prisma.io/docs/concepts/components/prisma-client/middleware/soft-delete-middleware

Our users regularly misunderstand that this is just a proof of concept of something you can do with a middleware, not the ultimate solution to implement soft deletes in Prisma: prisma/prisma#3398 (comment) (and many more messages in that thread before)

We should fix that somehow.

@janpio janpio added the docs Documentation creation, updates or corrections label Nov 15, 2021
@andrew-walford-prisma andrew-walford-prisma self-assigned this Sep 5, 2022
@tanberry
Copy link
Contributor

tanberry commented Sep 6, 2022

Options (possible some combo):

  1. change the titles to be more descriptive, that it is only an example... but let's not use the word "example" maybe "sample use of middleware" ... since "example" implies the code snippet will indeed work in most cases.
  2. remove the soft delete page all together (maybe ask Dev Adv if they want to blog about it)
  3. leave the page there, and add qualifying sentences/caveats... the caveats could be a list of the known places where it does not work. Something at top of page, then the list.
  4. Ask the engineers to help update the code sample so that the list of what does not work... maybe we can reduce the number of things that do not work. (There is already a ticket (#10559) for engineering to work on fixing some of the items that do not work. Let's align our Docs effort with the work they do.

Perhaps we start with option number 1, and then do option number 3 now, then work with Devs to align on option number 4.

Let's ask @andrewicarlson if he has data on how many people use this, and in what scenarios.

There are no Docs PRs on this.

@andrew-walford-prisma
Copy link
Contributor

Tana and I have agreed to do 1 and 3 immediately, so the doc isn't misleading, and then research 4.

@andrew-walford-prisma
Copy link
Contributor

andrew-walford-prisma commented Sep 6, 2022

I'm going to create a separate docs issue for 1 and 3, so that we can progress that work as a discrete unit.

Edit: here it is: #3727

@andrew-walford-prisma
Copy link
Contributor

We have the following list of possible exceptions with the soft delete middleware. However, we need to confirm these before we add them to the docs. In addition, we have an open engineering ticket that aims to fix some of this, which I'm monitoring.

Limitations

The soft delete sample on this page is not a full implementation. In the options above, we explain some of the limitations. Other limitations include the following:

  • findMany with options such as some and none does not work
  • Most nested queries, such as findMany({ where: {}, include: {}}) and update({data: { posts: { deleteMany: { } } } }) do not work
  • Cascading deletes do not work
  • You cannot update related tables with updateMany
  • You cannot enforce referential actions
  • You cannot filter deleted relations
  • You cannot use the sample in conjunction with a conditional unique index

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation creation, updates or corrections
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants