hasura / hasura/graphql-engine

cli: warn if applied and unapplied migrations are being squashed together

Open
#8,119 0 comments 0 reactions 0 assignees View on GitHub
c/cli k/enhancement 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?

In case some of the migrations being squashed are already applied and some are not, post squashing there is no way to apply the missing parts of the squashed migration to the db (other than running the SQL manually of course) and typically will lead to errors in the next migration apply.

### Describe the solution you'd like

Allow squashing migrations only if all the involved migrations are either applied or unapplied. In case an inconsistency is observed, raise a warning to the user mentioning the problem this would create. Also suggest the solution, ie. apply the unapplied migrations on the database before squashing. Allow the user to ignore the warning in case they know what they are doing and have reasons to do so

### Describe alternatives you've considered

Contributor guide

Open the contributing guide

Research direction

No file, test, or entry point is named in the issue. Start by locating the CLI migration-squashing implementation and its existing tests, then trace how applied and unapplied migrations are identified. Done means mixed states produce a warning with the suggested remedy while allowing an explicit override.

Written by the indexing model from the issue text.

Assessment

Tech stack
sql, typescript
Domain
cli, database
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.