hasura / hasura/graphql-engine

Add a migrate bump command in the cli

Open
#9,624 0 comments 0 reactions 0 assignees View on GitHub
k/enhancement t/cli
Dominant language
TypeScript
Stars
32.1k
Forks
3k
PR merge metrics
PR metrics pending

Description

Usually when you are working with a team there is a chance of migrations getting outdated and become out of order i.e. newer migrations are merged and some old migrations are not merged. This causes discrepancies i.e. the order of migration applied to an existing database becomes different than on a new database.
Right now the solution is to create a new migration (`hasura migrate create`) and copy the content from the old migration file and delete the old migration before the change is merged.
A much simpler solution would be to have a `bump` command that does the same i.e. just move/rename(`mv`) the existing migration file to a newer timestamp.
```bash
hasura migrate bump [old-migration-name] # just changes the timestamp in the name to latest
```
nice to have: ability to pass multiple file names and the ability to provide a range like squash

Contributor guide

Open the contributing guide

Research direction

Start by tracing the existing `hasura migrate create` command and how migration filenames are located and renamed. Define the behavior of `hasura migrate bump [old-migration-name]`, including the latest timestamp and preserving file contents; treat multiple names and ranges as optional follow-up scope. Done means an existing migration can be moved to the new timestamp without changing its contents or causing ordering discrepancies.

Written by the indexing model from the issue text.

Assessment

Domain
cli
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.