Only run one down migration by default. #10

pselden opened this Issue Feb 20, 2012 · 15 comments


None yet

pselden commented Feb 20, 2012

It seems like it would be a more sensible default to only run the most recent "down" migration when running "migrate down". Perhaps I just haven't thought enough into this, but I don't know a time when I would ever want to run a full teardown. It would seem to be much more reasonable just to roll back the most recent migration when running "migrate down", and maybe have a new keyword when you want to roll back every migration.


kishorenc commented Mar 2, 2012

I agree too. Thoughts TJ?


tj commented Mar 2, 2012

sure im fine with that, i dont even like the terms up/down personally but that's a different issue i guess

What you think about these?
migrate up [#steps] or migrate down [#steps]
for example:
migrate up 1 // -> executes one up migration
migrate down 3 // -> executes two down migrations

hyzhak commented Apr 14, 2014

+1 for $ migrate [up/down] N

Shouldn't migrate down perform a rollback to the last time migrate up was run? This makes it easier to hook into a deploy/rollback script. Eg. on deployment a deploy script would call migrate up, on a rollback it would call migrate down.

That's how it works in the Rails world and makes it very easy to hook into Capistrano an other deployment tools. We currently use cap for our node deployments so we just need a way to trigger migrations, I'm hoping node-migrate does the trick.


limianwang commented Apr 2, 2015

I totally agree to have it so that when you run the migrate down it should perform a rollback to a previous version. Say you've ran a bunch of migrations today, and some error occurred, we should be able to migrate down to the last time it was performed successfully.

Jokero commented Apr 25, 2015

I agree with @brianviveiros and @limianwang



LinusU commented Apr 27, 2015

I think that "rollback" would be the best solution but we currently don't save enough information to be able to do that. I propose that we quickly fix this by defaulting to one step down, this seem sensible.


joaosa commented May 5, 2015

Sounds sensible to me as well.

m4nuC commented Jan 21, 2016

What happened to this issue ? Is anyone on it ?

We ended up building this as a replacement:

Sadly myself and the co-author have moved on to other roles and different stacks so it is no longer maintained, but you can fork it and tweak as needed.


wesleytodd commented Sep 23, 2017

If anyone wants to return and champion this idea, can you roll this conversation up into a solid proposal for the 1.x branch?


wesleytodd commented Dec 1, 2017

Closing for inactivity

@wesleytodd wesleytodd closed this Dec 1, 2017

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