John Cantrell
11/19/2020, 8:13 PMRyan
11/20/2020, 6:31 AMmodel User {
id Int @id @default(autoincrement())
email String @unique
}
And I try to add 2 users with the same email:
await prisma.user.upsert({
create: { email: '<mailto:user1@g.com|user1@g.com>' },
update: { email: '<mailto:user1@g.com|user1@g.com>' },
where: { id: 1 },
})
await prisma.user.upsert({
create: { email: '<mailto:user1@g.com|user1@g.com>' },
update: { email: '<mailto:user1@g.com|user1@g.com>' },
where: { id: 2 },
})
The second will fail.John Cantrell
11/20/2020, 5:44 PMawait prisma.user.upsert({
where: { email: '<mailto:user1@g.com|user1@g.com>' },
create: { email: '<mailto:user1@g.com|user1@g.com>'},
update: {}
})
await prisma.user.upsert({
where: { email: '<mailto:user1@g.com|user1@g.com>' },
create: { email: '<mailto:user1@g.com|user1@g.com>'},
update: {}
})
Ryan
11/23/2020, 7:32 AMupdate
block is empty.