I'm new to Prisma so bear with me. I have a (Postgres) DB on Supabase and I have the following model:
model user {
created_at DateTime? @default(now()) @db.Timestamptz(6)
email String @unique
id BigInt @id @default(autoincrement())
}
As you can see, email is set to unique. However, when I try to query it with .findUnique() like so:
const data = await prisma.user.findUnique({
where: {
email: user.email
}
})
I get the following error:
Error:
Invalid `prisma.user.findUnique()` invocation:
{
where: {
email: 'johndoe@gmail.com'
~~~~~
}
}
Unknown arg `email` in where.email for type userWhereUniqueInput. Did you mean `id`? Available args:
type userWhereUniqueInput {
id?: BigInt
}
The table is currently empty, so I am expecting to get back an empty array. But instead, I get this error. If I run the query as .findMany() I get the empty array and no error.
What am I missing here?