Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Table referencing itself #47

Open
francescovenica opened this issue May 2, 2021 · 4 comments
Open

Table referencing itself #47

francescovenica opened this issue May 2, 2021 · 4 comments

Comments

@francescovenica
Copy link

francescovenica commented May 2, 2021

Hello,

I have a question about a case where a table has a parent_id like this:

CREATE TABLE item (
  uuid uuid PRIMARY KEY DEFAULT uuid_generate_v4 (),
  parent_uuid uuid REFERENCES item (uuid) ON DELETE CASCADE,
  title text
);

is it possible from this to create the parent item and also the child item (wo where parent_uuid is the uuid of the parent item)?

many thanks

@Eldow
Copy link
Contributor

Eldow commented Jun 25, 2021

Yes it is.

mutation CreateItemMutation {
  createItem(input: {
    item: {
      title: "parent"
      itemsToParentIdUsingId: {
        create: [{
          title: "child A"
        }, {
          title: "child B"
        }]
      }
    }
  }) {
    clientMutationId
  }
}

@francescovenica
Copy link
Author

@Eldow I know a lot of time passed but I'm still have this issue, I'm not able to create more then 1 child, how did you get that working with an array?

@tmair
Copy link

tmair commented Dec 12, 2022

It seems this issue is a duplicate of #33 which is currently not fixed

@Eldow
Copy link
Contributor

Eldow commented Dec 13, 2022

It might be worth checking out my fork : https://github.com/Eldow/postgraphile-plugin-nested-mutations
It fixed some of the issues I faced at the time but I ended up stopping using it in the end in favor of custom mutations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants