2022-12-13 18:12:43 +00:00
|
|
|
#!/bin/sh
|
|
|
|
# Reset databases and migrations, for development only
|
|
|
|
|
|
|
|
[ -f manage.py ] || exit $1
|
|
|
|
|
2022-12-13 16:33:58 -05:00
|
|
|
echo "\033[0;31mWARNING: this script will destroy all neodb databases and migrations"
|
2022-12-13 18:12:43 +00:00
|
|
|
while true; do
|
2022-12-13 16:33:58 -05:00
|
|
|
read -p "Do you wish to continue? (yes/no) " yn
|
2022-12-13 18:12:43 +00:00
|
|
|
case $yn in
|
|
|
|
[Yy]* ) break;;
|
|
|
|
[Nn]* ) exit;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
psql $* postgres -c "DROP DATABASE IF EXISTS neodb;" || exit $?
|
|
|
|
|
|
|
|
psql $* postgres -c "DROP DATABASE IF EXISTS test_neodb;" || exit $?
|
|
|
|
|
|
|
|
psql $* postgres -c "CREATE DATABASE neodb ENCODING 'UTF8' LC_COLLATE='en_US.UTF-8' LC_CTYPE='en_US.UTF-8' TEMPLATE template0;" || exit $?
|
|
|
|
|
|
|
|
find -type d -name migrations | xargs rm -rf
|
|
|
|
|
2023-01-11 20:36:30 -05:00
|
|
|
python3 manage.py makemigrations mastodon users management common catalog journal social legacy
|
2022-12-13 18:12:43 +00:00
|
|
|
|
|
|
|
python3 manage.py migrate || exit $?
|
|
|
|
|
|
|
|
psql $* neodb -c "CREATE DATABASE test_neodb WITH TEMPLATE neodb;" || exit $?
|
|
|
|
|
|
|
|
python3 manage.py check
|