Prisma ORM · Prisma Client queries

Update or create

Update the record if it exists, otherwise create it.

await prisma.user.upsert({
  where: { email: "[email protected]" },
  update: { name: "Ada" },
  create: { email: "[email protected]", name: "Ada" },
});

Official Prisma ORM documentation

More prisma client queries commands

All prisma client queries commands · Prisma ORM cheatsheet

Was this page helpful?