duplicate key value when generating data with `autoconnect: true`
THardy98 opened this issue · 2 comments
THardy98 commented
version 0.78.3
I have a Prisma schema defined as:
model RelationBetweenAandB{
aId String
a AModel @relation(fields: [aId], references: [id])
bId String
b BModel @relation(fields: [bId], references: [id])
@@id([aId, bId])
}
I've generated data for A
and B
and have attempted to generate data for RelationBetweenAandB
using:
snaplet.RelationBetweenAandB((x) => x(10), { autoConnect: true })
but the consequent results create records with the same primary key.
Not sure if this is a known issue or if it's a user error.
THardy98 commented
no longer an issue as of 0.81.0
justinvdm commented
Hi @THardy98, sorry, got here too late but glad you got it working with 0.81.0
.
What could have been the case, was there were two plans that needed to be composed with snaplet.$pipe()
to avoid ending up creating data from the same seed. Luckily the API changed in 0.81.0
to not need snaplet.$pipe()
anymore.