Open kgkg opened 1 year ago
You should use TypeORM migrations, as that will support your use case better. We'll work with our Documentation team to add more information on using custom migrations system with Hasura GraphQL.
We also have a use case where our developers launch Hasura Console via our internal dev web portal. Because of this, Hasura migrations are not persisted to the disk. An API to get a list of all migrations or a way to generate incremental migrations using cli would be very helpful.
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.