-
-
Save Epictetus/4958275 to your computer and use it in GitHub Desktop.
This file contains 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
if [ $# -eq 0 ] ; then | |
echo "No args given" | |
echo "Missing Heroku app name" | |
exit 1 | |
fi | |
APP_NAME="--app ${1}" | |
echo "heroku addons:add heroku-postgresql:dev ${APP_NAME}" | |
heroku addons:add heroku-postgresql:dev ${APP_NAME} | |
echo | |
echo "heroku addons:add pgbackups:auto-week ${APP_NAME}" | |
heroku addons:add pgbackups:auto-week ${APP_NAME} | |
echo | |
echo "heroku maintenance:on ${APP_NAME}" | |
heroku maintenance:on ${APP_NAME} | |
echo | |
echo "Capture a backup of your current database:" | |
echo "heroku pgbackups:capture --expire ${APP_NAME}" | |
heroku pgbackups:capture --expire ${APP_NAME} | |
echo | |
COLOR=`heroku config ${APP_NAME} | grep POSTGRESQL | cut -d'_' -f 3` | |
echo "Restore the backup to your new db:" | |
echo "heroku pgbackups:restore HEROKU_POSTGRESQL_${COLOR} ${APP_NAME}" | |
heroku pgbackups:restore HEROKU_POSTGRESQL_${COLOR} ${APP_NAME} | |
echo | |
echo "Set your new database to be the primary database for your application:" | |
echo "heroku pg:promote HEROKU_POSTGRESQL_${COLOR} ${APP_NAME}" | |
heroku pg:promote HEROKU_POSTGRESQL_${COLOR} ${APP_NAME} | |
echo | |
echo "heroku maintenance:off" | |
heroku maintenance:off ${APP_NAME} | |
echo | |
echo "remove shared-database" | |
echo "heroku addons:remove shared-database ${APP_NAME}" | |
heroku addons:remove shared-database ${APP_NAME} | |
echo | |
echo "heroku pg:info ${APP_NAME}" | |
heroku pg:info ${APP_NAME} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment