-
Notifications
You must be signed in to change notification settings - Fork 517
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 Add flag to retrieve N most recent migrations #256
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
This is interesting. Is this a workaround to force If so, I'd much rather see a |
No that is not the intention of this flag. This flag is intended to be able to quickly return the last N number of migrations for a database when running the There are 2 reasons that I find this helpful. The first is when I am checking if an environment has had the latest migrations applied I don't want to see the full list of migrations just the last 5-10 to make sure that the migrations are The second use case that I find it useful is because my team creates migrations for stories and this is all happening asynchronously and one story that is started first might take longer than another that finishes faster. Then at this point the timestamp of the migration that was created first would be out of sync and would not get applied if the date isn't updated. With my current project we have hundreds of migrations and it takes quite a long time for goose to print out all the migrations when using that status command just to see if the order of the migration you are trying to add is correct. This second scenario could also be solved by just looking at the file names but it could be a lot easier to just run the status command if only the last few migrations are printed. |
My issue with this PR is that it modifies the resulting migrations list in If you'd like to print last-n migrations we can likely accomplish this with another implementation specific for As mentioned in #256 (comment), I'd rather properly add opt-in disable strict mode to address things like this:
|
Resolves #254
This PR adds a flag that allows the user to retrieve the N most recent migrations. This is useful when you have many migrations that you have created and it takes a long time to print them all out and you just want to see the last few to either make sure they have all been applied or to make sure that the new migration timestamp you are working on will still be applied when another collaborator may have created and merged a migration before you.
usage example:
goose -n 10 mysql "[DB_String]" status
This would return the 10 most recent migrations