Visitenbuch/run/db_up.sh

18 lines
528 B
Bash
Executable file

#!/bin/bash
set -e
DIR="$(cd "$(dirname "$0")" && pwd)"
cd "$DIR"
docker compose up -d
echo 'Waiting for database to be ready...'
"$DIR/wait-for-it.sh" "localhost:5432" -- echo 'Database is ready!'
# Create temporary test database
docker compose exec -u 999:999 db sh -e -c 'dropdb -f --if-exists test; createdb test'
cd "$DIR/../"
DATABASE_URL="postgresql://postgres:1234@localhost:5432/test?schema=public" npx prisma migrate reset --force
# Reset main database
npx prisma migrate reset --force
npx tsx run/gen-mockdata.ts