bookwyrm-mastodon/rebuilddb.sh

26 lines
447 B
Bash
Raw Normal View History

2020-01-26 15:14:27 -05:00
#!/bin/bash
set -e
if [ ! -f .env ]; then
echo "No .env found -- copying .example.env to .env!"
cp .env.example .env
fi
2020-02-15 17:19:36 -05:00
source .env
if [ $FEDIREADS_DATABASE_BACKEND = 'sqlite' ]; then
if [ -f fedireads.db ]; then
rm fedireads.db
fi
2020-02-15 17:19:36 -05:00
else
# assume postgres
dropdb fedireads
createdb fedireads
fi
2020-01-26 15:14:27 -05:00
python manage.py makemigrations fedireads
python manage.py migrate
python manage.py shell < init_db.py
2020-01-26 20:55:02 -05:00
python manage.py runserver