Search code examples
hasura

How to add a string length constraint in Hasura GraphQL?


In the Hasura console, I have a field for a table that is of type string and I wish for this field to be limited to 7 characters. What kind of regex or expression do you add for this to work?


Solution

  • I added in the Hasura console a constraint under check expression: length(colour_code) = 7