How to have ID type in schema for primary keys?
See original GitHub issueHi,
it seems that Hasura doesn’t generate the graphql type ID
(https://graphql.github.io/graphql-spec/June2018/#sec-ID) for primary keys. Instead it generates a scalar type matching the type of the primary key in the database.
So, in case my primary key is a bigint then in the schema I will have
scalar bigint
type todo {
id: bigint!
...
}
The problem is that other tools (eg. https://github.com/mobxjs/mst-gql) depend on the existence of a unique identifier for types and expects it to be the one field with type ID
.
Would it be possible to have a Hasura server setting / environment variable, which enables generation of ID
types for primary fields instead of the default mechanism?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:27
- Comments:12 (3 by maintainers)
Top Results From Across the Web
How do I define a different primary key other than _id in ...
In MongoDB, there is no primary key. All you need is an unique: true index and you're good to go. const DocumentSchema =...
Read more >Mongodb Primary Key: Example to set _id field with ObjectId()
In MongoDB, _id field as the primary key for the collection so that each document can be uniquely identified in the collection.
Read more >Database Schema Structure - DbSchema
Columns are defined to hold a specific type of data such as numeric, dates, or text. Column names can't be duplicated in a...
Read more >SHOW PRIMARY KEYS - Snowflake Documentation
Lists primary keys for the specified table, or for all tables in the current or specified schema, or for all tables in the...
Read more >Primary Keys in Relational Databases - YouTube
Beginner video - an introduction to primary keys in relational databases. Primary Keys need to be UNIQUE and NOT NULL, but not really ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The new Remote Relationships with v1.3 do not work with Sanity.io because their id’s are of type
ID!
which Hasura does not support. Using another type likeuuid!
gets you an exception when trying to create a new remote relationships:A possible solution would be to define the type that is needed by a remote schema (like
ID!
)Do we have any update on this? This is a blocker for us too trying to integrate with Strapi which uses ID as a type for its collections 😞