Skip to content

Benefits of using the enum functionality? #6462

Answered by leoalves
joshuarobs asked this question in General
Discussion options

You must be logged in to vote

@joshuarobs

If you set a table as ENUM those values will be in the GraphQL schema. If the client tries to send a different value it will error out without hitting the database. It also makes it easier to test. You can just introspect the schema to see the allowed values, instead of making a request to the server.

But there are a few limitations with it and it is not always the best solution. For example, if the ENUM value change you need to reset the metadata to see them in the schema. If the values are dynamic or have the possibility to change I would avoid the ENUM. Also it is saved as a field in the table and not as a relationship. Sometimes it is better to have a relationship.

I used …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by joshuarobs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
General
Labels
None yet
2 participants