0

I am working on a project which is backed by Hasura. I am having difficulty creating an enum and getting it to auto-generate the values.

I've successfully created a migration according to the enum spec, and verified it is loading values into the database. Next I ran yarn hasura console, and from the console started tracking both tables I created & set BaseColor to be an enum type. I added a permission for public to SELECT from BaseColor.

Next I ran yarn hasura metadata export. That generated a tables.yml with BaseColor's table definition having is_enum true.

Then I ran, yarn update-schema (i.e. get-graphql-schema http://localhost:8080/v1/graphql > schema.graphql). The generated file is missing the BaseColor_enum I would expect to be present for an enum.

dysbulic
  • 3,005
  • 2
  • 28
  • 48

1 Answers1

0

get-graphql-schema only generates an _enum for a table if that table is referenced by another.

So, if I add a foreign key that references BaseColor, it will generate BaseColor_enum, otherwise it won't.

dysbulic
  • 3,005
  • 2
  • 28
  • 48