Hasura-data is a postgres with hasura instance that manages data and access to it.
- Use the docker container service with docker-compose to install database-hasura.
- Use the Hasura CLI to manage migration.
Dev
configuration immediately starts the database snapshot and rolls all migrations.- After launch, hasura console is available at localhost:8081/console, if it is not disabled in the configuration.
- The
./hasura
directory contains the initial configuration forhasura cli
. - When working with the database through the
hasura console
, the changes will be exported to the migration and metadata directory where thehasura cli
was initialized.
All commands must be executed in the ./hasura
directory or initialized a new directory.
-
hasura init
- Initialize directory for Hasura GraphQL Engine migrations, but you can use the existing.hasura
directory. You will need to specify the configuration in theconfig.yaml
file. -
hasura migrate create baseline --from-server
- Exports a snapshot of the current database schema namedbaseline
to themigrations
directory. -
hasura metadata export
- Exports the entire hasura metadata schema. The uploaded data is placed in themetadata
directory. -
hasura console --console-port 8083
- Runs hasura console on localhost:8083/console. -
hasura migrate create <name-of-migration>
- Create sql and yaml files required for a migration. -
hasura migrate squash --name "<feature-name>" --from <migration-version>
- Squash multiple migrations leading upto the latest one into a single migration file. -
hasura migrate apply --endpoint <server-endpoint>
- Apply migrations on the database. -
hasura metadata apply --endpoint <server-endpoint>
- Apply Hasura metadata on a database. -
hasura migrate status
- Display current status of migrations on a database.
Build or rebuild services:
docker-compose -f docker-compose.yaml -f docker-compose.dev.yaml build
Builds, (re)creates, starts, and attaches to containers for a service:
docker-compose -f docker-compose.yaml -f docker-compose.dev.yaml up -d
If you want to run hasura for dev, but no migrations:
docker-compose -f docker-compose.yaml -f docker-compose.dev.reup.yaml up -d hasura
Stops containers and removes containers, networks, volumes, and images
created by up
.
- Not for production!
- docker-compose -f docker-compose.yaml -f docker-compose.dev.yaml down -v
Just builds, (re)creates, starts, and attaches to containers for a service:
docker-compose -f docker-compose.yaml -f docker-compose.prod.yaml up -d