hasura / hasura/graphql-engine
I mess up squash too easily
- Dominant language
- TypeScript
- Stars
- 32.1k
- Forks
- 3k
- PR merge metrics
- PR metrics pending
Description
### Is your proposal related to a problem?
When first using Hasura, I often wished for a squash feature when working through migrations at development time. The addition of `hasura migrate squash` is excellent. However, I find that it's easy to make mistakes when using it. For example, if you don't remember to rollback before squashing, then you could cause metadata inconsistencies.
```zsh
git status
# multiple migrations are ready to stage during development time and are already applied
hasura migrate squash
git status
# one migration is ready for staging now but i forget to hasura migrate apply --down 1 before I squashed
git add .
git commit -m "Add squashed migration and potentially inconsistent metadata"
```
### Describe the solution you'd like
The command would at least provide a way to tell it to rollback to the `--from` version before squashing:
```zsh
hasura migrate squash --from [migration version] --rollback-first
```
Tangentially related, what if there was a switch for including `hasura metadata apply` in migrate as well so I don't forget that?
```zsh
hasura migrate apply --apply-metadata-after
```
### Describe alternatives you've considered
I could be fundamentally using squash incorrectly in the first place? 😅
### If the feature is approved, would you be willing to submit a PR?
I don't know Haskell. 😬
Contributor guide
Assessment
This issue has not been assessed yet.