forked from mtusi2026/mtusi2026lab5
feat:report
This commit is contained in:
+15
-3
@@ -6,8 +6,20 @@ URL_FILE="${DATABASE_URL_FILE:-/run/secrets/database_url}"
|
||||
DATABASE_URL="$(cat "$URL_FILE")"
|
||||
PSQL="psql $DATABASE_URL -v ON_ERROR_STOP=1 -q"
|
||||
|
||||
for f in migrations/*.sql; do
|
||||
echo "applying $f"
|
||||
$PSQL -f "$f"
|
||||
echo "waiting for postgres..."
|
||||
for i in $(seq 1 60); do
|
||||
if psql "$DATABASE_URL" -c 'SELECT 1' >/dev/null 2>&1; then
|
||||
echo "postgres is ready"
|
||||
break
|
||||
fi
|
||||
echo " attempt $i: not ready yet"
|
||||
sleep 1
|
||||
done
|
||||
|
||||
psql "$DATABASE_URL" -c 'SELECT 1' >/dev/null
|
||||
|
||||
for f in /app/migrations/*.sql; do
|
||||
echo "applying $f"
|
||||
psql "$DATABASE_URL" -v ON_ERROR_STOP=1 -f "$f"
|
||||
done
|
||||
echo "migrations done"
|
||||
Reference in New Issue
Block a user