19 lines
No EOL
472 B
Bash
19 lines
No EOL
472 B
Bash
#!/bin/sh
|
|
|
|
until pg_isready -U clearing -h db -p 5432 -d clearing -t 1; do
|
|
echo "Waiting for database to be ready..."
|
|
sleep 2
|
|
done
|
|
|
|
echo "PSQL version: $(psql --version)"
|
|
echo "DB password is $PGPASSWORD"
|
|
echo "Database connection test:"
|
|
psql -U clearing -h db -p 5432 -d clearing -c "SELECT 'Database is connected!' AS status"
|
|
|
|
echo "Executing SQL file:"
|
|
cat init.sql
|
|
|
|
echo "Updating database"
|
|
psql -U clearing -h db -p 5432 -d clearing -f init.sql
|
|
|
|
tail -f /dev/null |