outcaste-io / issues

File issues here across all public Outcaste Repositories
Apache License 2.0
6 stars 0 forks source link

cascade delete AND deep nested updates #13

Open jdgamble555 opened 2 years ago

jdgamble555 commented 2 years ago

https://discuss.dgraph.io/t/feature-request-cascade-delete-deep-mutations-by-reference-directive/14658

cascade delete

If I delete a user, I may want to delete all the user's posts. If I delete a post, I may want to delete all the post's comments. If this is not handled internally, we will end up phantom nodes or orphan nodes (nodes without connections, wasting space, and can cause database discrepancies).

There is currently impossible to even do this manually, as this would require nested filters. However, this should be done internally like SQL databases.

deep nested updates

Currently I can add nested data, but I cannot update nested data. I can only update their links to other nodes. This is only one minute case. If I have Zip Codes, I don't want to update them from a parent. There are three cases:

  1. You don't want to allow the nested nodes to be updated (current usage)
  2. You want to allow the nested nodes to be updated by their ID / @id
  3. You want to replace the entire nested value, like an array

See [notion.so(https://freezing-cabin-946.notion.site/The-State-of-Dgraph-s-GraphQL-API-d7b2c0f4d33341f0b93d09c13fd033a1) for more specific info.

Both of these problems are solvable with a Reference Directive that I suggested here.

To me, this is a huge data integrity problem. It is basically solved by triggers in sql.

J