Closed alaarihan closed 3 years ago
Did you test it?
Yes, I did, without this change the generator will produce this typeDef for this model
model Category {
id Int @id @default(autoincrement())
name String
parentId Int?
parent Category? @relation("CategoryTree", fields: [parentId], references: [id])
children Category[] @relation("CategoryTree")
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}
export default gql`
type Category {
id: Int!
name: String!
parentId: Int
parent: Category
createdAt: DateTime!
updatedAt: DateTime!
}
...
After this change the generator will produce this..
export default gql`
type Category {
id: Int!
name: String!
parentId: Int
parent: Category
children(
where: CategoryWhereInput
orderBy: CategoryOrderByInput
cursor: CategoryWhereUniqueInput
take: Int
skip: Int
distinct: CategoryDistinctFieldEnum
): [Category!]!
createdAt: DateTime!
updatedAt: DateTime!
}
...
I've found a problem after the last fix, self relation typeDefs don't get generated, this PR fix that