diff --git a/upgrade_db.sh b/upgrade_db.sh index c5f4df465..c119e83c8 100755 --- a/upgrade_db.sh +++ b/upgrade_db.sh @@ -1,5 +1,20 @@ +#!/bin/bash + +PYTHON="./env/bin/python" +if [ ! -x $PYTHON ]; then + echo "No python executable found at ${PYTHON}" + if type python2 &>/dev/null; then + PYTHON=python2 + elif type python &>/dev/null; then + PYTHON=python + else + echo "No python executable found anywhere" + exit + fi +fi + # Execute from root dir as: bash upgrade_db.sh for file in db/migrations/* do - python $file $1 upgrade + $PYTHON $file $1 upgrade done