【发布时间】:2019-09-22 19:09:30
【问题描述】:
我正在与 Prisma 合作,我想支持 CASCADE delete,但尽管我已经完成了文档中提到的所有操作,但我仍然无法使用它
这是我在尝试部署 Prisma 时遇到的错误
Errors:
Restaurant
✖ The Mongo connector currently does not support Cascading Deletes, but the field `foods` defines cascade behavior. Please remove the onDelete argument.}
这里是代码
type Restaurant {
id: ID! @id
name: String!
foods: [Food!]! @relation(onDelete: CASCADE, name: "FoodToRestaurant", link: INLINE)
}
type Food {
id: ID! @id
name: String!
desc: String
price: Float!
category: Category!
restaurant: Restaurant! @relation(name: "FoodToRestaurant", onDelete: SET_NULL)
}
我希望当餐厅被删除时,它的所有食物也应该被删除
我已使用 Prisma PostgreSQL 删除了 CASCADE,但现在我想将 MongoDB 用于此应用程序
【问题讨论】:
-
由于 Prisma MongoDB 连接器当前不支持级联删除(请参阅GitHub issue #3796),因此应该出现错误消息。
标签: mongodb prisma prisma-graphql