imkFinal/backend/scripts/init-db.sh

25 lines
588 B
Bash
Executable File

#!/bin/sh
echo "Starting development initialization..."
# Wait for database to be ready
echo "Waiting for database to be ready..."
until PGPASSWORD=$POSTGRES_PASSWORD psql -h postgres -U $POSTGRES_USER -d postgres -c '\q'; do
echo "Postgres is unavailable - sleeping"
sleep 1
done
echo "Database is ready!"
# Run Prisma migrations
echo "Running Prisma migrations..."
npx prisma migrate dev
# Generate Prisma Client (just in case)
echo "Generating Prisma Client..."
npx prisma generate
# Start the application
echo "Starting application in development mode..."
npm run start:dev