I have problem with prisma upsert(), I get info:
PrismaClientValidationError: Invalid
prisma.prismaUser.upsert()invocation:{ where: { email: 'viola@prisma.io' ~~~~~ }, update: { name: 'Viola the Magnificent' }, create: { email: 'viola@prisma.io', name: 'Viola the Magnificent', profileViews: 0, role: 'admin' } }
Unknown arg
id? Available args: type prismaUserWhereUniqueInput { id?
My code: schema.prisma
// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
model prismaUser {
id Int @id @default(autoincrement())
name String @db.VarChar(255)
email String @db.VarChar(255)
profileViews Int
role String @db.VarChar(255)
}
node.js
const { PrismaClient } = require("@prisma/client");
const prisma = new PrismaClient();
// A `main` function so that you can use async/await
async function main() {
await prisma.prismaUser.upsert({
where: {
email: "viola@prisma.io",
},
update: {
name: "Viola the Magnificent",
},
create: {
email: "viola@prisma.io",
name: "Viola the Magnificent",
profileViews: 0,
role: "admin",
},
});
}
main()
.catch((e) => {
throw e;
})
.finally(async () => {
await prisma.$disconnect();
});
Anyone can help me and explain what is wrong?