You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
If I select the option "Does this model belong to the user? yes" for child models, it will mess up the references due to the fields becoming DocumentType instead of documentTypes
To Reproduce
? Please select the resources you would like to generate: Model, Controller, View
? Please select the type of view you would like to generate: Server Actions with Optimistic UI
? Please select any additional controllers you would like to generate:
? Please enter the table name (plural and in snake_case): organisations
? Please select the type of this field: string
? Please enter the field name (in snake_case): name
? Is this field required? yes
? Would you like to add another field? no
? Would you like to set up an index? no
? Would you like timestamps (createdAt, updatedAt)? yes
? Does this model belong to the user? yes
? Would you like to add a child model? (organisations) yes
? Please enter the table name (plural and in snake_case): document_types
? Please select the type of this field: string
? Please enter the field name (in snake_case): name
? Is this field required? yes
? Would you like to add another field? no
? Would you like to set up an index? yes
? Which field would you like to index? name
? Would you like timestamps (createdAt, updatedAt)? yes
? Does this model belong to the user? yes
? Would you like to add a child model? (document_types) no
? Would you like to add a child model? (organisations) yes
? Please enter the table name (plural and in snake_case): documents
? Please select the type of this field: string
? Please enter the field name (in snake_case): title
? Is this field required? yes
? Would you like to add another field? no
? Would you like to set up an index? yes
? Which field would you like to index? title
? Would you like timestamps (createdAt, updatedAt)? yes
? Does this model belong to the user? yes
? Would you like to add a child model? (documents) no
? Would you like to add a child model? (organisations) no
? Would you like to add a link to 'Organisations' in your sidebar? yes
ℹ Updated Prisma schema 10:38:45 AM
? Would you like to add a link to 'Document Types' in your sidebar? yes
ℹ Updated Prisma schema 10:38:47 AM
? Would you like to add a link to 'Documents' in your sidebar? yes
ℹ Updated Prisma schema 10:38:48 AM
Results in
model Organisation {
id String @id @default(cuid())
name String
userId String
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
DocumentType DocumentType[]
Document Document[]
}
Which for example gives an error in lib/api/organisations/queries.ts
Object literal may only specify known properties, but 'documentTypes' does not exist in type 'OrganisationInclude<DefaultArgs>'. Did you mean to write 'DocumentType'?ts(2561)
Expected behavior
If I generate without the "belongs to user" option for child models, it works well.
Screenshots
Desktop (please complete the following information):
OS: [e.g. iOS]
Browser [e.g. chrome, safari]
Version [e.g. 22]
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered:
From kirimase created by kaikun213: nicoalbanese#172
Config File
Describe the bug
If I select the option "Does this model belong to the user? yes" for child models, it will mess up the references due to the fields becoming
DocumentType
instead ofdocumentTypes
To Reproduce
Results in
Which for example gives an error in
lib/api/organisations/queries.ts
The error:
Expected behavior
If I generate without the "belongs to user" option for child models, it works well.
Screenshots
Desktop (please complete the following information):
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: