Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alternative ID types #2562

Open
stwiname opened this issue Sep 24, 2024 · 1 comment
Open

Alternative ID types #2562

stwiname opened this issue Sep 24, 2024 · 1 comment

Comments

@stwiname
Copy link
Collaborator

Background

Currently all entities need to have id: ID to follow the graphql spec. Internally with postgres this creates a TEXT primary key column. This can have some limitations when using numbers as the id and ordering because it will order lexicographically.

Solution

We can add an additional directive to the graphql schema to allow specifying a different underlying type.

type Entity @entity {
  id: ID @dbType(type: "serial")
}

Requirements

  • This should still be compatible with historical indexing
  • Limit the type to compatible types.
  • Compatible with schema migrations
  • Update the store interface for Id to be optional when creating new entities and return the generated id. This could be pushed to a future release.
@jorgecuesta
Copy link

This is something we are looking forward for our project at Pocket Network https://github.com/pokt-network/pocketdex

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants