pkmntrade.club/scripts/reset-db_make-migrations_seed-data.sh
2025-05-09 08:43:43 -07:00

19 lines
553 B
Bash
Executable file

#!/bin/bash
# Exit immediately if any command exits with a non-zero status.
set -e
# Reset the database and migrations.
echo "Resetting database and migrations... "
docker compose down \
&& docker volume prune -a --filter label=db_is_resettable_via_script \
&& find . -path "*/migrations/00*.py" -delete \
&& docker compose up -d
# Wait for the database to be ready.
echo "Waiting for the database to be ready..."
sleep 10
echo "Loading seed data..."
docker compose exec -it web bash -c "django-admin loaddata /seed/0*"
echo "Done & Started!"