[](https://travis-ci.org/darwintantuco/auto-rollback)
npm install auto-rollback
Custom post-checkout git hook to auto rollback new migrations on git checkout
git config is used to set rollback status
Backup existing post-checkout hook
rails
npm >= 5.2.0
bash
#### Enable auto migrate on git checkout
``bash`
$ npx auto-rollback enable
#### Disable auto migrate on git checkout
`bash`
$ npx auto-rollback disable
#### Show rollback status
`bash`
$ npx auto-rollback status
After git checkout:
1. Execute git checkout bundle exec rake db:migrate:down VERSION=
1. Get migration versions
1. Execute for each versiondb/migrate/
1. Undo all changes in and db/schema.rb
The flow will be less complicated if pre-checkout git hook exist
- Assumes all migration are reversible
- bundle exec rake db:migrate:down VERSION=
MIT