Graphql-engine: Squash migrations

Created on 23 May 2019  路  5Comments  路  Source: hasura/graphql-engine

We are just starting to use hasura and I'm trying to modify schema via console UI to leverage automatic migrations. Because it trial and error process I ended up with tens of migration files. These files are meant to be kept in repository and subject to code review. Right now its not possible because all errors in the process are also expressed as separate migrations.

Is it possible to squash the migrations somehow or generate them only after pressing some "save" button?

cli enhancement high

Most helpful comment

My company also ran into the issue that large amount of migrations were hard to review. I made a small CLI tool that will squash uncomitted migrations to a single migration, while also prettifying sql and pruning repeat permission edits: https://github.com/domasx2/hasura-squasher

All 5 comments

This blogpost just came out! Hopefully this will help.

https://blog.hasura.io/resetting-hasura-migrations/

Feel free to keep iterating and then when you reach a good checkpoint, you can squash pretty easily.

Thanks! this sounds like a solution indeed. One thing I still need to investigate is how to make the process partial. By this I mean that migrations currently kept in repository (already committed) should stay but all the new ones (not commited) should be squashed. I think this should be possible but I'm still to verify that.

amazing article finally there :)

Yeah, I kinda wish there was a way in hasura console to commit all changes as a migration as a button.

Currently we are running into the situation where we end up creating 200 files after deliberating over the schema in hasura console.

My company also ran into the issue that large amount of migrations were hard to review. I made a small CLI tool that will squash uncomitted migrations to a single migration, while also prettifying sql and pruning repeat permission edits: https://github.com/domasx2/hasura-squasher

Was this page helpful?
0 / 5 - 0 ratings

Related issues

marionschleifer picture marionschleifer  路  3Comments

bogdansoare picture bogdansoare  路  3Comments

EmrysMyrddin picture EmrysMyrddin  路  3Comments

shahidhk picture shahidhk  路  3Comments

lishine picture lishine  路  3Comments