How to regenerate metadata/tables.yaml in Hasura

Viewed 236

I am working with merging master into a branch that was made some time ago. It created a Hasura migration and then several more were added in master.

There are now merge conflicts in metadata/tables.yaml. tables.yaml is generated and maintained by Hasura, correct?

Hasura won't start with the conflicted tables.yaml. I replaced it with one from hasura init and was able to remove the Docker images (docker-compose down -v) and recreate them (docker-compose up --build -d).

When I run hasura migrate status it shows all the migrations as run, but the contents of metadata/tables.yaml hasn't changed.

How do I regenerate that file?

1 Answers

The correct command is hasura metadata export. I tried this initially and the command generated an empty array ([]). It turns out this is because I replaced the tables.yaml with an empty set in order to get Hasura to start.

After running hasura console, rewatching the tables, and resetting the permissions; the metadata export command worked as expected and regenerated tables.yaml.

Related