Currently we just have this one example at https://docs.hasura.io/1.0/graphql/manual/mutations/insert.html#insert-an-object-and-its-nested-object-in-the-same-mutation
@0x777 Are you looking for more explanation or better visibility?
This is also repeated at https://docs.hasura.io/1.0/graphql/manual/mutations/multiple-mutations.html#insert-an-object-and-a-nested-object-in-the-same-mutation
Explanation, for example, what is update_columns/constraint etc. Few examples with many-to-many relationships too will help.
any update on this? Currently its a huge grey zone how insert/updates of relations in general works. I have a 1:1 relation of users => client setup and have a hard time to get the statement up and running.
mutation{
insert_users(
objects:[
{
email:"test"
password:"test"
role:"client",
first_name:"test"
client:{
data:{
placement_status_id:1
}
}
}
]
){
affected_rows
}
}
I receive an error
{
"errors": [
{
"extensions": {
"path": "$.selectionSet.insert_users.args.objects[0]",
"code": "constraint-violation"
},
"message": "Not-NULL violation. null value in column \"id\" violates not-null constraint"
}
]
}
What is your id field type?
@lishine this is a current limitation of nested inserts for 1-1 relationships. Its being tracked at #2576.
Most helpful comment
@lishine this is a current limitation of nested inserts for 1-1 relationships. Its being tracked at #2576.