Skip to content

I mess up squash too easily #7563

@gabrieljoelc

Description

@gabrieljoelc

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.

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:

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?

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. 😬

Metadata

Metadata

Assignees

No one assigned

    Labels

    c/cliRelated to CLIc/migrationsRelated to migrationsk/enhancementNew feature or improve an existing featuresupport/needs-triageNeeds to be triaged so that we have enough information to add this to our backlog

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions