Postgres-hasura is a postgres with hasura instance that manages data and access to it.
- Use the docker container service with docker-compose to install postgres-hasura.
- Use the Hasura CLI to manage migration.
Devconfiguration 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
./hasuradirectory 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 cliwas 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.hasuradirectory. You will need to specify the configuration in theconfig.yamlfile. -
hasura migrate create baseline --from-server- Exports a snapshot of the current database schema namedbaselineto themigrationsdirectory. Use--schema myschema1,myschema2to export a specific schema. -
hasura metadata export- Exports the entire hasura metadata schema. The uploaded data is placed in themetadatadirectory. -
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
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 -vJust builds, (re)creates, starts, and attaches to containers for a service:
docker-compose -f docker-compose.yaml -f docker-compose.prod.yaml up -d