hasura / hasura/graphql-engine
"Cascade-Copy" / "Deep-Copy" Support
- Dominant language
- TypeScript
- Stars
- 32.1k
- Forks
- 3k
- PR merge metrics
- PR metrics pending
Description
### Is your proposal related to a problem?
Often, clients want to copy entities. Currently, one has to write and maintain significant amounts of code to support copy operations on entities that have a large amount of forgein-keys.
### Describe the solution you'd like
It would be great if hasura could generate these "Deep-Copy" SQL statements and make them available through its GraphQL API:
```
mutation CopyFolders($ids: [uuid!]!) {
copy_folders(where: {id: {_in: $ids}}, target: {user_id: {eq: $target_user_id}}) {
{
process_id # id to track progress of the copy operation
}
}
```
Furthermore, copy operations should support triggers. E.g. when a row from the "files"-table is copied, a trigger `copyFile` could be configured to call a function. This function could then, for example, copy an external (s3/azure) binary file.
### Describe alternatives you've considered
Only alternatives are completely custom written code.
### If the feature is approved, would you be willing to submit a PR?
I guess you hear this a lot, but unfortunately, I can't code in haskel.
If hasura were written in Golang or Rust I'd happy to work on this feature an submit a PR. But I guess that's whishful thinking for now. :P
Contributor guide
Research direction
Start by reviewing how Hasura exposes GraphQL mutations for PostgreSQL entities and how SQL statements for foreign-key relationships are generated. The proposal also requires progress tracking and trigger support for external files such as S3 or Azure binaries. Done would include an agreed design and implementation covering deep-copy mutations, configurable targets, progress reporting, and copy triggers.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- graphql, haskell, postgres
- Domain
- backend-api-design, databases
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100