Jaroslav Malek
09/29/2021, 3:03 PMId
even tho it’s not meant to be a foreign key, the mutation errors. Example:
prisma.business.create({
data: {
name: data.name,
// This is just a string and it is not supposed to be a FK, but Prisma thinks so
taxId: data.taxIdentifier,
address: {
create: {...},
},
clientOf: {
connect: {
id: businessId,
},
},
},
})
The way to fix this is to rename it from taxId
to taxIdentifier
for example. I was trying to find an issue in Github, but there is just so many issues and it’s hard to find it.Ryan
09/30/2021, 6:17 AMJaroslav Malek
09/30/2021, 7:17 AMRyan
09/30/2021, 9:07 AMJaroslav Malek
09/30/2021, 11:16 AMmodel Business {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
isClient Boolean @default(true)
domain String?
taxIdentifier String?
vatIdentifier String?
name String
addressId String?
address Address? @relation(fields: [addressId], references: [id])
clients Business[] @relation("BusinessToBusiness")
clientOf Business? @relation("BusinessToBusiness", fields: [clientOfId], references: [id])
clientOfId String?
}
model Address {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
countryCode String
city String?
line1 String?
line2 String?
zip String?
isPrimary Boolean @default(false)
businesses Business[]
}
Ryan
09/30/2021, 11:24 AMtaxId
as well. I think the issue is different here.Ryan
09/30/2021, 11:26 AMRyan
09/30/2021, 11:27 AMundefined
in the data
Jaroslav Malek
09/30/2021, 12:13 PM