Content Deep Dive
GraphQL schema on Postgres with foreign keys and without foreign keys
Blog post from Hasura
Post Details
Company
Date Published
Author
Shahidh K Muhammed
Word Count
515
Language
English
Hacker News Points
-
Source URL
Summary
The Hasura GraphQL Engine allows for modeling a graph using a relational database system like Postgres. It supports creating relationships between tables (nodes) using single-column foreign keys, multi-column foreign keys, or even without foreign keys. In the case of single-column foreign keys, Hasura's console suggests relationships over these columns and derives a GraphQL schema containing relation names for querying both tables in a single query. Relationships can also be created manually without a constraint, allowing for more flexibility when defining relations between tables. This enables GraphQL queries over extra information not necessarily constrained by foreign keys.