Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
niladic committed Feb 10, 2025
1 parent bd24a37 commit 7ba3c50
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
1 change: 0 additions & 1 deletion Procfile

This file was deleted.

2 changes: 1 addition & 1 deletion app.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@
}
],
"scripts": {
"first-deploy": "bash scripts/copy-scalingo-review-app-db.sh"
"postdeploy": "bash scripts/copy-scalingo-review-app-db.sh"
}
}
8 changes: 4 additions & 4 deletions scripts/copy-scalingo-review-app-db.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ if [ "$IS_REVIEW_APP" = "true" ]; then

USER_COUNT=$(/app/bin/psql "${SCALINGO_POSTGRESQL_URL}" -A -t -c 'SELECT COUNT(*) FROM "user";')

if [ "$USER_COUNT" = "0" ]; then
if [ "$USER_COUNT" -gt 0 ] 2>/dev/null; then
echo "Table 'user' has $USER_COUNT rows. Doing nothing."
else
echo "Table 'user' has $USER_COUNT rows. Copying parent app db to review app db."

/app/bin/pg_dump --clean --if-exists --format c --dbname "${PARENT_APP_DATABASE_URL}" --no-owner --no-privileges --no-comments --exclude-schema 'information_schema' --exclude-schema '^pg_*' | /app/bin/pg_restore --clean --if-exists --no-owner --no-privileges --no-comments --dbname "${SCALINGO_POSTGRESQL_URL}"

else
echo "Table 'user' has $USER_COUNT rows. Doing nothing."

fi

else
Expand Down

0 comments on commit 7ba3c50

Please sign in to comment.