Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running with --only should not fail if migration has already been run #18

Open
chadxz opened this issue Mar 16, 2018 · 5 comments
Open

Comments

@chadxz
Copy link
Contributor

chadxz commented Mar 16, 2018

When a migration has already been run, right now it bails out saying that the specified migration is not pending, and exits with an error status.

I think in a scenario where the specified migration doesn't exist, it makes sense to exit with an error status. But if the migration does exist and has already been run, I think it would make sense for the app to simply say "migration already applied" and exit with a success status. If the migration is already applied, the goal of running the command is already accomplished, so it isn't an error right?

This seems to be the logic that works for up... if you're already at the latest migration, then it simply does nothing and exits with a success status. I'm thinking this logic should be extended to running with --only as well.

LMK what you think.

@sheerun
Copy link
Owner

sheerun commented Mar 26, 2018

This makes sense. You could include this fix in your PR as well if you can manage to do it :)

btw. I've updated many things in 1.5.3, so please remember to pull before you start implementing it

chadxz added a commit to chadxz/knex-migrate that referenced this issue Mar 26, 2018
chadxz added a commit to chadxz/knex-migrate that referenced this issue Mar 26, 2018
@chadxz
Copy link
Contributor Author

chadxz commented Mar 26, 2018

Failing test for this issue

https://github.com/sheerun/knex-migrate/compare/master...chadxz:failing-test-%2318?expand=1

Given this project is knex bindings + cli on top of umzug, not sure if the change should go here or there. Will keep looking.

@chadxz
Copy link
Contributor Author

chadxz commented Mar 26, 2018

knex-migrate pretty much just calls out to umzug with the name of the migration specified in --only %migration%. In umzug they explicitly check for the migration to be pending and fail with the error message indicated in the failing test. I opened an issue there to see what they think about making the change.

@sheerun
Copy link
Owner

sheerun commented Mar 27, 2018 via email

@chadxz
Copy link
Contributor Author

chadxz commented May 12, 2020

Related Umzug issue: sequelize/umzug#167

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants