imkFinal/backend/scripts/init-dev.sh

21 lines
476 B
Bash
Executable File

#!/bin/sh
echo "Starting development server..."
# 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 --name init
# Start the application
echo "Starting application..."
npm run start:dev