Skip to content

Instantly share code, notes, and snippets.

@kbaird
Created September 20, 2013 16:19
Show Gist options
  • Save kbaird/6640077 to your computer and use it in GitHub Desktop.
Save kbaird/6640077 to your computer and use it in GitHub Desktop.
Shell script for reverting migrations found in a dev branch and not found in master branch.
#!/bin/bash
git diff --name-only master db/migrate/ | sed "s/migrate\//migrate\n/" | grep -v migrate | sed "s/\_/\n/" | grep -v rb | xargs -I vnum rake db:migrate:down VERSION=vnum
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment