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

Feature: redo command (like Rails db:migrate:redo) #205

Closed
tohagan-tmr opened this issue Dec 7, 2021 · 3 comments · Fixed by #207
Closed

Feature: redo command (like Rails db:migrate:redo) #205

tohagan-tmr opened this issue Dec 7, 2021 · 3 comments · Fixed by #207
Assignees
Milestone

Comments

@tohagan-tmr
Copy link
Contributor

tohagan-tmr commented Dec 7, 2021

Please add a migrate redo command so that ...

$ migrate redo       

... runs migrate down 1 and if that succeeds it runs migrate up 1 and ...

$ migrate redo 3 

... runs migrate down 3 and if that succeeds it runs migrate up 3

I know, I know .... I've asked a lot this week! But I think this would be a great addition and should be dead easy to implement.

I've recently been using Ruby of Rails which was the one of the first (I think the first) frameworks to support DB migrations. They support a rails db:migrate:redo (ref) command. I found this is very convenient when coding as I'm constantly typing the two commands. I can just write my own shell script to do the same but I think it really it belongs with the migrate command.

@tohagan-tmr
Copy link
Contributor Author

Here's the equivalent Bash function ...

function migrate_redo() {
  n="${1-1}"
  migrate down "$n" && migrate up "$n"
}

harawata added a commit to harawata/migrations that referenced this issue Dec 8, 2021
@harawata harawata self-assigned this Dec 8, 2021
@harawata harawata added this to the 3.3.10 milestone Dec 8, 2021
@tohagan-tmr
Copy link
Contributor Author

Thank you !!

@harawata
Copy link
Member

I actually do the down-then-up a lot, so thank you for the request! :)

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

Successfully merging a pull request may close this issue.

2 participants