Migrations and Metadata
This section will teach you how to manage database migrations and Hasura metadata in a local dev environment setup.
Hasura needs two components to (re)create a GraphQL API.
- Database schema
The database schema can either be of an existing database or created from scratch. The metadata will describe the GraphQL API and the various components of Hasura, like permissions, events, actions, and remote schemas.
Hasura doesn't automatically create the GraphQL API for the entire database. We will need to specify which tables/views/functions need to be exposed via GraphQL, and this information will be part of the metadata.
We will use the slack clone database schema for this demo. But before that, let's run Hasura on the local dev environment.
Running Hasura via docker-compose
The most straightforward setup to run Hasura locally is to use the docker-compose setup to run both graphql-engine and Postgres docker containers.
Head to the docs to set up Hasura locally using docker-compose.
Once you have set up Hasura locally, you should be able to access the console at
- Build apps and APIs 10x faster
- Built-in authorization and caching
- 8x more performant than hand-rolled APIs