I have 2 tables:
- Contacts
- Company
They are having many to one relationship which means i can add company when creating contact record.
Problem is i want to make company field optional in contact, i am able to do it and can add record from table directly but not able to create record through query.
Could you please help me with it.
Sharing example below
mutation (
$name: String!
$companyName: String // getting error here, type should be String!
) {
contactCreate(
data: {
name: $name
company: {
create: {
companyName: $companyName
}
}
}
) {
id
}
}
Thanks