-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
Steps to reproduce
- Create a prisma schema with a composite primary key.
- Make a prisma-feathers query and try to select specific fields (e.g. "topicId")
Expected behavior
We should be able to select specific fields for a table with a composite primary key.
Actual behavior
The generated code is trying to select an id, which doesn't exist.
We believe the problem may be with the buildSelect function?
https://github.com/ps73/feathers-prisma/blob/main/src/utils.ts#L126
We get the following error (for all our tables that have composite primary keys):
Unknown field `id` for select statement on model topics_pages. Available options are listed in green.
Error: GeneralError:
Invalid `prisma.topics_pages.findMany()` invocation:
{
skip: 0,
take: 100,
orderBy: [],
where: {
pageId: {
in: [
1
]
}
},
select: {
id: true,
~~
? topicId?: true,
? pageId?: true
}
}
System configuration
Tell us about the applicable parts of your setup.
Prisma Schema
model topics_pages {
topicId Int @map("topic_id")
pageId Int @map("page_id")
@@id([topicId, pageId])
@@index([pageId], map: "topics_pages_page_id_index")
@@index([topicId], map: "topics_pages_topic_id_index")
}
Module versions (especially the part that's not working):
package.json
"@feathersjs/commons": "^5.0.24",
"@feathersjs/errors": "^5.0.24",
"@feathersjs/feathers": "^5.0.24",
"@feathersjs/hooks": "^0.9.0",
"@feathersjs/schema": "^5.0.24",
"@feathersjs/transport-commons": "^5.0.24",
"@feathersjs/mongodb": "^5.0.24",
"@prisma/client": "^5.11.0",
"@prisma/generator-helper": "^5.11.0",
"feathers-prisma": "^0.7.0",
NodeJS version:
v20.12.2
Operating System:
Browser Version:
React Native Version:
Module Loader:
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels