Cree Jee
10/01/2021, 12:47 PM//other
model LayoutSetting {
id Int @id @default(autoincrement())
relatedLayoutToProduct LayoutSettingLinkProduct[]
}
model LayoutSettingLinkProduct {
layoutId Int
productId Int
order Int
layout LayoutSetting @relation(fields: [layoutId], references: [id])
product Product @relation(fields: [productId], references: [id])
@@id([layoutId, productId])
@@index([order])
}
model Product {
id Int @id @default(autoincrement())
relatedLayoutToProduct LayoutSettingLinkProduct[]
}
After executing many transactions and queries as a batch program, the following errors occurred.
Invalid `prisma.layoutSettingLinkProduct.deleteMany()` invocation:
Failed to validate the query: `Field does not exist on enclosing type.` at `Mutation.deleteManyLayoutSettingLinkProduct`
at cb (/Users/creejee/*****/renewal-project/*********/node_modules/@*****************/appsync-schema/prisma/generated/client/runtime/index.js:36952:17)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async upsertLayout (/Users/creejee/*****/renewal-project/*********/util/batch/appsync/insertProductData.js:59:9)
at async task (/Users/creejee/*****/renewal-project/*********/util/batch/appsync/insertProductData.js:496:9) {
code: 'P2009',
clientVersion: '3.1.1',
meta: {
query_validation_error: 'Field does not exist on enclosing type.',
query_position: 'Mutation.deleteManyLayoutSettingLinkProduct'
}
}
The following sample code was written for problem trouble shooting, and there was no error at this time.
const layout = await prismaClient.layoutSetting.create({
data: {},
});
const product = await prismaClient.product.create({
data: {},
});
if (layout && product) {
await prismaClient.layoutSettingLinkProduct.createMany({
data: {
layoutId: layout.id,
productId: product.id,
order: 1,
},
});
const { count } =
await prismaClient.layoutSettingLinkProduct.deleteMany({
where: {
layoutId: layout.id,
},
});
console.log(count);
}
I don’t know what I need to solve the problem, and I don’t know why there’s no error in the sample code...
Is this a bug? Or is it my fault?Ryan
10/01/2021, 12:56 PMCree Jee
10/01/2021, 1:05 PMRyan
10/01/2021, 1:23 PMCree Jee
10/01/2021, 1:53 PMCree Jee
10/02/2021, 9:59 AM