feat:report

This commit is contained in:
Оля Мороз
2026-11-16 20:30:12 +03:00
parent 90f407b174
commit c91ec7790f
37 changed files with 1159 additions and 209 deletions
+15 -3
View File
@@ -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"