initialize-database: Print nice instructions for how to redo if fails.

Most of our installation process is idempotent, but this step in
particular is not, so it's important to provide a clear error message
about how to proceed.
This commit is contained in:
Tim Abbott 2015-09-29 18:24:46 -07:00
parent 3efdb7ebf3
commit 5bf66e04fc
1 changed files with 11 additions and 1 deletions

View File

@ -7,6 +7,16 @@ python manage.py checkconfig
python manage.py migrate --noinput
python manage.py createcachetable third_party_api_results
python manage.py initialize_voyager_db
if ! python manage.py initialize_voyager_db; then
set +x
echo
echo -e "\033[32mPopulating default database failed."
echo "After you fix the problem, you will need to do the following before rerunning this:"
echo " * supervisorctl stop all # to stop all services that might be accessing the database"
echo " * scripts/setup/postgres-init-db # run as root to drop and re-create the database"
echo -e "\033[0m"
set -x
fi
supervisorctl restart all