-
-
Save kaizoku/834272cec7feb5df3d35f93472854677 to your computer and use it in GitHub Desktop.
rollback migrations to hawthorn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
shopt -s globstar | |
MIGRATIONS=$(git diff --name-only open-release/hawthorn.1 master **/migrations) | |
APPNAMES=$( | |
for MIGRATION in $MIGRATIONS | |
do | |
basename $(dirname $(dirname $MIGRATION)) | |
done|sort|uniq | |
) | |
for APP in $APPNAMES | |
do | |
LAST_MIGRATION=$(git ls-tree -r open-release/hawthorn.1 --name-only|egrep $APP/migrations/'[0-9]+_'|tail -n1) | |
LAST_MIGRATION=$(basename $LAST_MIGRATION) | |
/edx/bin/{python,manage}.ecommerce migrate $APP ${LAST_MIGRATION//.py} | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment