graphile / graphile/migrate

Allow force running of --once if current.sql has not changed

Open
#210 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
835
Forks
64
Avg merge
17m
Merged PRs (30d)
5

Description

### Feature description

Often we use tricks like `select n` and increment the number or change `current.sql` in another way to get it to run.

It would be handy to have a flag to force run `--once` if the file hasn't changed.

### Motivating example

When testing a data migration, it is often very handy to have an idempotent migration that can get run multiple times as you add/change data in your application.

Typical workflow for me in a data migration involves
- Keep the original data I am moving in place (if possible)
- Run the migration, check for base functionality, compare against existing
- Add more data to test the migration and run it again (rinse and repeat as needed)
- Once tested, add code to cleanup the original data, test again, and ship

Though workarounds are simple as described in the feature description, I think it would be a nice add.

### Breaking changes

n/a

### Supporting development

I [tick all that apply]:

- [ ] am interested in building this feature myself
- [ ] am interested in collaborating on building this feature
- [ x ] am willing to help testing this feature before it's released
- [ ] am willing to write a test-driven test suite for this feature (before it exists)
- [ x ] am a [Graphile sponsor](https://www.graphile.org/sponsor/) ❤️
- [ x ] have an active [support or consultancy contract](https://www.graphile.org/support/) with Graphile

Contributor guide

Open the contributing guide

Research direction

Start by tracing the --once handling and the logic that detects whether current.sql has changed. Determine how a force option should interact with that check, then verify the behavior with the existing migration tests or test entry points you find; done means an unchanged current.sql can be run repeatedly when explicitly forced.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql, sql, typescript
Domain
cli, databases
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 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.