postgraphile-plugin-nested-mutations
postgraphile-plugin-nested-mutations copied to clipboard
Table referencing itself
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
Yes it is.
mutation CreateItemMutation {
createItem(input: {
item: {
title: "parent"
itemsToParentIdUsingId: {
create: [{
title: "child A"
}, {
title: "child B"
}]
}
}
}) {
clientMutationId
}
}
@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?
It seems this issue is a duplicate of #33 which is currently not fixed
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.