hasura / hasura/graphql-engine

Generate migration diff from CLI

Open
#8,991 2 comments 2 reactions 0 assignees View on GitHub
k/enhancement s/docs-is-actioned t/product-platform
Dominant language
TypeScript
Stars
32.1k
Forks
3k
PR merge metrics
PR metrics pending

Description

### Is your proposal related to a problem?

We're using TypeORM to define database structure. Right now the only way to create hasura migrations is changing database structure via hasura console, so we need to define structure in both Hasura and TypeORM (which is terrible dev experience and also is prone to errors).

What we want to achive is flow like
1) update typeorm entity files
2) synchronize dev db using typeorm's sync
3) generate migrations diff with Hasura to apply migrations on stage/prod envs.

### Describe the solution you'd like

The solution would be a way to generate migration as **diff** from currently applied migrations via command line.

It could be done with command `hasura migrate diff` like most ORMs do.

### Describe alternatives you've considered

We could use TypeORM migratons but it will make our deployment flow much harder to perform - one server (with typeorm) would update database, while server running Hasura has to update it's metadata. It would be much easier to manage migrations with Hasura.

### If the feature is approved, would you be willing to submit a PR?

Unfortunatelly I'm not familiar with implementing database diff algos.

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.