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

Add --number flag to dbmate down #316

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mg98
Copy link

@mg98 mg98 commented Sep 5, 2022

It bugged me that I had to rollback migrations one by one if I needed to rollback multiple.
Also, the option to rollback all migrations at once (instead of drop) could be useful for CI testing.

@mg98 mg98 force-pushed the feat/number-argument-on-dbmate-down branch from f99b63d to 9fe336d Compare September 5, 2022 09:15
@mg98 mg98 changed the title Add --number flag on dbmate down Add --number flag to dbmate down Sep 5, 2022
@mg98 mg98 force-pushed the feat/number-argument-on-dbmate-down branch from 9fe336d to 34a3545 Compare September 5, 2022 11:03
@mg98 mg98 force-pushed the feat/number-argument-on-dbmate-down branch from 34a3545 to 7174ed1 Compare September 5, 2022 11:51
@gregwebs
Copy link

This would interact poorly with #434 (probably throw an error if both are specified). It seems like this could be accomplished externally with a loop (not sure how annoying that is in your case).

@gregwebs
Copy link

gregwebs commented Apr 20, 2023

#256 also tries to tackle this by specifying a target to migrate down to. I think the approach there could be safer and avoid accidental off by 1 errors, etc?

@mg98
Copy link
Author

mg98 commented Apr 21, 2023

I'm currently not using this lib in any project so I'm not opinionated. I feel like such an option would be useful and more convenient than typing the version, especially when working collaboratively or on different branches. I don't see this being at particularly high risk for off-by-1 errors.

With regards to #434, you mean when both arguments were to be specified at once? Not sure, maybe.
Might take a look on it again depending how this discussion concludes ;)

@gregwebs gregwebs mentioned this pull request Apr 26, 2023
4 tasks
@gregwebs
Copy link

I opened #438 which allows a syntax for specifying a range of migration. If you wanted to specify migrating down the last 2 versions, you could use -m -2.... But that needs to be combined with a flag or command that would allow for rolling back multiple migrations at once.

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

Successfully merging this pull request may close these issues.

None yet

3 participants