hasura / hasura/graphql-engine

docs: add guide on how to use the existing yaml and meta file to have a code-first approach of using hasura

Open
#4,461 2 comments 3 reactions 1 assignee Claimed by @coco98 View on GitHub
c/docs k/ideas
Dominant language
TypeScript
Stars
32.1k
Forks
3k
PR merge metrics
PR metrics pending

Description

Let's make it more fun using Hasura!

The code first approach way of using Hasura means:

> Managing everything related to Hasura (DB and Hasura features like (permission and relation)) via YAML and META file

Benefits including:
1. All benefits of adopting Infrastructure as Code
1. Can be version controlled
1. Easy replicating
1. The big picture in a glance
1. Enable future VSCode / WebStorm plugging for linting for better DX
1. Better CI/CD integration

In short, scalable and maintainable.

The current setup of Hasura already supports it. YAML file for DB, and META file for permission and relation.

But what about a section purely for using Hasura in a code-first way with an example:

Let's extend the `current Slack app permission example` on how to use it in a code-first way.

The tutorial might contain the following flow basically covers a lifecycle of an application:

1. not touch GUI
1. create DB schemas
1. create Hasura relations
1. create Hasura permissions
1. initialize the DB with the created yml and meta
1. Change schema / permission / relationship
1. Apply migration
1. Different `schema migration` handling:
1. new field
1. update the existin:g field with data
1. `data migration`: how to migrate the existing data to the new schema
1. Show some examples for handling/migrating different kind of request type on this [page](https://hasura.io/docs/1.0/graphql/manual/api-reference/schema-metadata-api/index.html#query)
1. Doing a rollback
1. Apply `dev` DB changes to `uat` / `production` DB

This is currently what I am thinking of. Thanks

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.