updateMany fails with "You can't specify target table 'Org' for update in FROM clause" error
For the following schema
running the following query results in an error
Error:
4 Replies
I believe this is caused because you don't have the field and reference parameters in your relation. This part of the docs explains how to use self relations https://www.prisma.io/docs/orm/prisma-schema/data-model/relations/self-relations
Self-relations | Prisma Documentation
How to define and work with self-relations in Prisma.
@Lord Zd Thank you for your reply. The docs mentions about my kind of schema in the last section and even the schema provided in the docs doesn't work (for updateMany) https://www.prisma.io/docs/orm/prisma-schema/data-model/relations/self-relations#defining-multiple-self-relations-on-the-same-model
Self-relations | Prisma Documentation
How to define and work with self-relations in Prisma.
Hey dude I had a similar problem with self relations I solved it by moving the relations to a separate table and splitting the query in to sections. This isn't a very elegant solution from my experience apologies I couldnt be of more help
@Lord Zd Thanks for the help