Skip to content

darwintantuco/auto-rollback

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

auto-rollback

Build Status

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

sample

Supported Apps

rails

Getting Started

Requirements

npm >= 5.2.0

bash

Usage

Enable auto migrate on git checkout

$ npx auto-rollback enable

Disable auto migrate on git checkout

$ npx auto-rollback disable

Show rollback status

$ npx auto-rollback status

How auto rollback on rails work?

After git checkout:

  1. Execute git checkout <previous-branch> db/migrate
  2. Get migration versions
  3. Execute bundle exec rake db:migrate:down VERSION=<version> for each version
  4. Undo all changes in db/migrate/ and db/schema.rb

The flow will be less complicated if pre-checkout git hook exist

Note

  • Assumes all migration are reversible
  • bundle exec rake db:migrate:down VERSION=<version> fails silently

License

MIT

About

Auto rollback new migrations on git checkout

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages