Created
March 5, 2019 13:14
-
-
Save viktorbenei/2e569abd10a409df121cba62a53f51ca to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -ex | |
if [ -z "$HEROKU_APP_ID" ] ; then | |
echo '!!! HEROKU_APP_ID not set' | |
exit 1 | |
fi | |
if [ -z "$HEROKU_DB_ADDON_ID" ] ; then | |
echo "!!! HEROKU_DB_ADDON_ID not set. You can get the Heroku DB addon ID from: $ heroku pg:info -a $HEROKU_APP_ID | grep -i 'add-on'" | |
exit 1 | |
fi | |
heroku maintenance:on -a $HEROKU_APP_ID | |
sleep 10 | |
heroku pg:maintenance:run "$HEROKU_DB_ADDON_ID" -a $HEROKU_APP_ID | |
sleep 10 | |
# wait for the maintenance to complete | |
heroku pg:wait -a $HEROKU_APP_ID | |
sleep 10 | |
heroku maintenance:off -a $HEROKU_APP_ID |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment