prisma-tools
prisma-tools copied to clipboard
sdlInput generation looks incorrect
@AhmedElywa
I have the following schema
model LeaveOfAbsence {
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
id String @id @default(cuid())
startDateTime DateTime
endDateTime DateTime
reason String?
cleaner Cleaner @relation(fields: [cleanerId], references: [id])
cleanerId String
}
model Cleaner {
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
id String @id @default(cuid())
leaveOfAbsence LeaveOfAbsence[]
agency Agency @relation(fields: [agencyId], references: [id])
agencyId String
}
model Agency {
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
id String @id @default(cuid())
name String @unique
cleaners Cleaner[]
}
With prisma, I'm able to create a LeaveOfAbsence
with nested creations of Cleaner
and Agency
However, the sdlInput types generated do not take into account nested creations. Below is the sdl generated with the help of generateGraphQlSDLFile
from @paljs/plugins
createOneLeaveOfAbsence(data: LeaveOfAbsenceCreateInput!): LeaveOfAbsence!
input LeaveOfAbsenceCreateInput {
createdAt: DateTime
updatedAt: DateTime
id: String
startDateTime: DateTime!
endDateTime: DateTime!
reason: String
cleaner: CleanerCreateNestedOneWithoutLeaveOfAbsenceInput!
}
input CleanerCreateNestedOneWithoutLeaveOfAbsenceInput {
create: CleanerUncheckedCreateWithoutLeaveOfAbsenceInput
connectOrCreate: CleanerCreateOrConnectWithoutLeaveOfAbsenceInput
connect: CleanerWhereUniqueInput
}
input CleanerUncheckedCreateWithoutLeaveOfAbsenceInput {
createdAt: DateTime
updatedAt: DateTime
id: String
# other types here
agencyId: String!
# more types here
}
As a result, apollo hooks generated by codegen do not follow the same types as prisma
I am not able to perform nested/transactional creations. Was pretty sure this wasn't an issue in the past. Maybe it's an issue with prisma's latest updates that are causing this issue
Hope the explanation is clear enough and hope to get some feedback asap!
My setup: "@paljs/plugins": "2.13.0", "@paljs/cli": "2.13.1", "@prisma/client": "2.20.1", "prisma": "^2.20.1",
Maybe it's an update from Prisma DMMF in the last version. I will check that and back to you
@AhmedElywa any updates on this?
Not yet was working on a big change in Prisma admin and ClI to support multiple Prisma schema in the sand project
okay noted! but just wondering if you have any indication on when you think you might finish working on this fix?