18 lines
405 B
Bash
18 lines
405 B
Bash
#!/bin/bash
|
|
# backend/scripts/test-db.sh
|
|
|
|
echo "Testing database connection..."
|
|
|
|
export PGPASSWORD=$POSTGRES_PASSWORD
|
|
|
|
echo "Attempting to connect to postgres:5432..."
|
|
pg_isready -h postgres -p 5432 -U $POSTGRES_USER
|
|
|
|
if [ $? -eq 0 ]; then
|
|
echo "Database connection successful!"
|
|
psql -h postgres -U $POSTGRES_USER -d $POSTGRES_DB -c "\dt"
|
|
else
|
|
echo "Database connection failed!"
|
|
exit 1
|
|
fi
|