如何使用Prisma从表中选择所有内容?(SELECT * FROM application)
const applications = prisma.application.findMany({
// Returns all user fields
include: {
posts: {
select: {
age: true,
about_section: true,
user_id: true
},
},
},
})
console.log(applications.age)
以下是我的模式图:
model application {
application_id Int @id @default(autoincrement())
age String? @db.VarChar(255)
about_section String? @db.VarChar(255)
user_id Int?
users users? @relation(fields: [user_id], references: [user_id], onDelete: Restrict, onUpdate: Restrict, map: "application_ibfk_1")
@@index([user_id], map: "user_id")
}