Many-To-Many relationship tables are required to have one non-relational field
willcbelcher opened this issue · comments
Describe the Bug
Many-To-Many relationship tables are required to have one non-relational field
To Reproduce
model Capability {
id Int @id @default(autoincrement())
name String
ownerId Int? @unique
owner User? @relation(fields: [ownerId], references: [id])
CapabilityAdmin CapabilityAdmin[]
@@map(name: "capabilities")
}
model CapabilityAdmin {
capabilityId Int
userId Int
comments String? // THIS FIELD IS REQUIRED
capability Capability @relation(fields: [capabilityId], references: [id], onDelete: Cascade)
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
@@id([userId, capabilityId])
@@map(name: "capability_admins")
}
model User {
id Int @id @default(autoincrement())
name String @db.VarChar(255)
CapabilityAdmin CapabilityAdmin[]
@@map("users")
}
In this model the "Comments" field or some other equivalent field is required on the many-to-many relationship table. If not, when the API is run, an error message displays that at least one argument is needed for that type.
Expected Behavior
The generator works and the API can be run without the extraneous field
Environment (please complete the following information):
- OS: Linux, Pop-OS 22.04 LTS
- Node (e.g. 15.8.0): node v 18.17.1, yarn version 1.22
typegraphql-prisma
version 0.27.0- Prisma version [e.g. 2.18.0] 4.16.2
- TypeScript version (e.g. 4.2.2) 5.1.6
Additional Context
Add any other context about the problem here.
Duplicate of #19 🔒