Migration helper script

This commit is contained in:
Oleg Lavrovsky 2017-01-24 10:08:22 +01:00
parent e78ecdf5e6
commit 308865bbdc
1 changed files with 15 additions and 0 deletions

15
force-migrate.sh Executable file
View File

@ -0,0 +1,15 @@
#!/bin/bash
if [ "$1" = "heroku" ]; then
echo "Migrating Heroku DB in 5 seconds - Ctrl-C to abort."
sleep 5s
heroku pg:psql -c "drop table alembic_version"
heroku run "python manage.py db init && python manage.py db migrate && python manage.py db upgrade"
else
echo "Resetting local DB in 5 seconds - Ctrl-C to abort."
echo "(Use 'heroku' argument to migrate Heroku instance)"
sleep 5s
rm -rf dev.db migrations
python manage.py db init
python manage.py db migrate
python manage.py db upgrade
fi