Skip to content
This repository was archived by the owner on Sep 2, 2022. It is now read-only.

cascading deletes error when deleteMany #2884

Closed
openefit opened this issue Aug 6, 2018 · 1 comment
Closed

cascading deletes error when deleteMany #2884

openefit opened this issue Aug 6, 2018 · 1 comment

Comments

@openefit
Copy link

openefit commented Aug 6, 2018

Describe the bug
It's ok to delete one sheet :

mutation {
  deleteSheet(where: {
      id: "cjkicttn700si0c004zej2o8e"
  }) {
    id
  }
}

errors when use deleleManySheets

mutation {
  deleteManySheets(where: {
    AND: [
      {
        id: "cjkicttn700si0c004zej2o8e"
      }, {
        id: "cjkid9a0400wg0c00hykowvnd"
      }, {
         id: "cjkid9th700x20c00gixwg7cw"
      }
    ]
  }) {
    count
  }
}

error message:

Error: The change you are trying to make would violate the required relation 'SheetRows' between Row and Sheet
    at BatchedGraphQLClient.<anonymous> (/****/node_modules/http-link-dataloader/src/BatchedGraphQLClient.ts:74:13)
    at step (/****/node_modules/http-link-dataloader/dist/src/BatchedGraphQLClient.js:40:23)
    at Object.next (/****/node_modules/http-link-dataloader/dist/src/BatchedGraphQLClient.js:21:53)
    at fulfilled (/****/node_modules/http-link-dataloader/dist/src/BatchedGraphQLClient.js:12:58)
    at process._tickCallback (internal/process/next_tick.js:68:7)
[GraphQL error]: Message: The change you are trying to make would violate the required relation 'SheetRows' between Row and Sheet, Location: [object Object], Path: deleteManySheets
[Network error]: Error: The change you are trying to make would violate the required relation 'SheetRows' between Row and Sheet

To Reproduce
here is the datamodel.graphql

type Sheet {
  id: ID! @unique
  rows: [Row!]! @relation(name: "SheetRows" onDelete: CASCADE)
}

type Row {
  id: ID! @unique
  belong: Sheet! @relation(name: "SheetRows")
  items: [Item!]! @relation(name: "RowItems", onDelete: CASCADE)
}
type Item {
  id: ID! @unique
  belong: Row! @relation(name: "RowItems")
  value: String
}

Versions (please complete the following information):

  • OS: Ubuntu 18.04
  • prisma CLI: [ prisma/1.13.6 (linux-x64) node-v10.7.0]
  • dependencies
{
  "dependencies": {
    "bcryptjs": "2.4.3",
    "crypto": "^1.0.1",
    "graphql-yoga": "^1.14.12",
    "jsonwebtoken": "8.2.0",
    "prisma-binding": "^2.1.1"
  },
  "devDependencies": {
    "@types/bcryptjs": "2.4.1",
    "dotenv-cli": "1.4.0",
    "graphql-cli": "^2.16.5",
    "nodemon": "1.17.3",
    "npm-run-all": "4.1.2",
    "prisma": "^1.12.0",
    "rimraf": "2.6.2",
    "ts-node": "4.1.0",
    "typescript": "2.8.1"
  }
}
@marktani
Copy link
Contributor

marktani commented Aug 6, 2018

Thanks for bringing this up, @openefit! This is a known limitation. You can track our progress with building cascading deletes for deleteMany here: #1936.

@marktani marktani closed this as completed Aug 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants