You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CREATETABLEproject (
id SERIALNOT NULL,
name VARCHAR(300) NOT NULL,
PRIMARY KEY (id)
);
CREATETABLEsubcontract (
id SERIALNOT NULL,
name VARCHAR(300) NOT NULL,
project_id INTEGERNOT NULL,
PRIMARY KEY (project_id, id),
FOREIGN KEY (project_id) REFERENCES project (id)
);
CREATETABLEinvoice (
id SERIALNOT NULL,
title VARCHAR(300) NOT NULL,
subcontract_id INTEGERNOT NULL,
project_id INTEGERNOT NULL,
PRIMARY KEY (id),
FOREIGN KEY (project_id, subcontract_id) REFERENCES subcontract (project_id, id),
FOREIGN KEY (project_id) REFERENCES project (id)
);
The following definition is generated for the invoice table
"""columns and relationships of "invoice""""typeinvoice {
id: Int!"""An object relationship"""project: project!project_id: Int!"""An object relationship"""subcontract: subcontract # this field is not marked as requiredsubcontract_id: Int!title: String!
}
Where the subcontract relation is marked as optional where it should be required
What is the expected behaviour?
The following definition is generated for the invoice table
"""columns and relationships of "invoice""""typeinvoice {
id: Int!"""An object relationship"""project: project!project_id: Int!"""An object relationship"""subcontract: subcontract! # this field should be marked as requiredsubcontract_id: Int!title: String!
}
Where the subcontract relation is marked should be marked as required because all keys part of the foreign key are required
How to reproduce the issue?
Create the tables in with the provided sql
Track all tables
Track all relationships
Screenshots or Screencast
Not apply
Please provide any traces or logs that could help here.
No error thrown
Any possible solutions?
Expected behaviour: If all fields of a foreign key are required the field should be marked as required, otherwise it must be optional. Current behaviour: always it is optional no matter what.
Can you identify the location in the source code where the problem exists?
No idea
If the bug is confirmed, would you be willing to submit a PR?
No idea where to start
Keywords
The text was updated successfully, but these errors were encountered:
Version Information
Server Version: 2.8.4
CLI Version (for CLI related issue):
Environment
OSS Docker version following https://hasura.io/docs/latest/graphql/core/getting-started/docker-simple/
What is the current behaviour?
For the following database
The following definition is generated for the invoice table
Where the subcontract relation is marked as optional where it should be required
What is the expected behaviour?
The following definition is generated for the invoice table
Where the subcontract relation is marked should be marked as required because all keys part of the foreign key are required
How to reproduce the issue?
Screenshots or Screencast
Not apply
Please provide any traces or logs that could help here.
No error thrown
Any possible solutions?
Expected behaviour: If all fields of a foreign key are required the field should be marked as required, otherwise it must be optional.
Current behaviour: always it is optional no matter what.
Can you identify the location in the source code where the problem exists?
No idea
If the bug is confirmed, would you be willing to submit a PR?
No idea where to start
Keywords
The text was updated successfully, but these errors were encountered: