-
Notifications
You must be signed in to change notification settings - Fork 30
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
@adminjs/relations can't use implicit relations from Prisma #50
Comments
The documentation for My guess is that your junction table actually exists in DMMF but uses a different, Prisma-created name. With reference to: I'd try logging Alternatively, you could explicitly define your junction table in your Prisma schema and it should appear in |
Hi @dziraf, thanks for the quick reply! I've printed the I've also tried passing manually a model, something like this:
But I get a Looks like the only way out is to create an explicit relationship, do you have an idea of anything else that I could try before doing this? |
I think the safest approach right now would be to define an explicit model for the junction table. I assumed Prisma creates virtual models anyway but it might be they're querying that table simply by table name and foreign keys, but this is something we cannot access in AdminJS since we're using model methods for querying. I'll try to arrange some time for me to investigate this. |
That'd be great. I don't really know how AdminJS internals work, but I was thinking maybe the Prisma adapter could be modified to include implicit relations |
That would only work if:
which is something I'll have to check |
I am using Prisma's implicit relations (https://www.prisma.io/docs/orm/prisma-schema/data-model/relations/many-to-many-relations#implicit-many-to-many-relations) for a table that I want to use and I get the error: "Error: There are no resources with given id: "_assetRelation"", that is, the implicit table created by prisma.
When I try to add a resource for the table I get the error "Error: Could not find model: "_assetRelation" in Prisma's DMMF!"
The text was updated successfully, but these errors were encountered: