我在 Prisma 模式中有这两个表:
model Accounts {
id Int @id @default(autoincrement())
name String @db.VarChar(100)
description String? @db.VarChar(255)
timeZone Int @default(0)
tableBusinessApplication AccountsBusinessApplications[]
}
model AccountsBusinessApplications {
id Int @id @default(autoincrement())
account Accounts @relation(fields: [accountId], references: [id])
accountId Int
name String @db.VarChar(100)
identification String @db.VarChar(100)
secretKey String @db.VarChar(32)
}
Run Code Online (Sandbox Code Playgroud)
我有以下代码:
const name = 'Accounts'
prisma[name].findFirst({
where: { id: 1}
}).then(result => { console.log(result) })
Run Code Online (Sandbox Code Playgroud)
结果我有:
{
id: 1,
name: 'test',
description: 'test description',
timeZone: 0
}
Run Code Online (Sandbox Code Playgroud)
但我在里面没有看到“ tableBusinessApplication ”。如果我只知道一级名称“ Accounts ”并且无法在查询中使用“ Include …