Files
web_sport/infrastructure/scripts/reset-db.sh
T

16 lines
453 B
Bash

#!/usr/bin/env bash
#
# Destroy and rebuild the local database. Local development only.
#
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
cd "$ROOT"
printf "\033[33mThis deletes every row in the local database. Continue? [y/N] \033[0m"
read -r reply
[[ "$reply" =~ ^[Yy]$ ]] || { echo "Aborted."; exit 0; }
pnpm --filter @sport/api exec prisma migrate reset --force
printf "\033[32mDatabase reset and reseeded.\033[0m\n"