I want to do a query on this table called SRCMembers using the following code
const members = await db.sRCMembers.findMany()
i’m importing Prisma through the db file as such
import db from "db"
and this exact syntax is working on auto generated models such as ‘user’
const members = await db.user.findMany()
but when I run that code I get and error that says
‘TypeError: Cannot read properties of undefined (reading ‘findMany’)’
the following is the schema.prisma model
model SRCMembers {
id Int @id @default(autoincrement())
studentNumber String
name String
surname String
age String
branch String @default("1st year")
email String
course String?
year String?
}
the code editor picks up the ‘findMany’ and even gives hints on it.
but when executed it is then undefined.
when I log SRCMembers I get this
{
findUnique: [Function (anonymous)],
findFirst: [Function (anonymous)],
findMany: [Function (anonymous)],
create: [Function (anonymous)],
createMany: [Function (anonymous)],
delete: [Function (anonymous)],
update: [Function (anonymous)],
deleteMany: [Function (anonymous)],
updateMany: [Function (anonymous)],
upsert: [Function (anonymous)],
count: [Function (anonymous)],
aggregate: [Function (anonymous)],
groupBy: [Function (anonymous)]
}
along with prisma as the ORM I am making use of BlitzJS
why is the findMany undefined and what can I do about it?