Database Reference
In-Depth Information
The pg:promote command
This command is useful to change the default database in your application. Through it you
can change which database responds to the DATABASE_URL variable. This command is
used frequently when a problem occurs, and then you can restore the backup in another
database and transform it to the default database.
To try this feature, you will add a new database and after that you will promote it to the
primary database:
$ heroku addons:add heroku-postgresql:hobby-dev -app
your-app-name
Adding heroku-postgresql:hobby-dev on your-app-name... done,
v17 (free)
Attached as HEROKU_POSTGRESQL_MAROON_URL
Database has been created and is available
! This database is empty. If upgrading, you can transfer
! data from another database with pgbackups:restore.
Use `heroku addons:docs heroku-postgresql` to view
documentation.
The command expects you to inform the URL about the database that will be promoted to
the DATABASE_URL :
$ heroku pg:promote HEROKU_POSTGRESQL_MAROON_URL --app
your-app-name
Promoting HEROKU_POSTGRESQL_MAROON_URL to DATABASE_URL...
done
You can use the pg:info command to check the change in the DATABASE_URL vari-
able:
$ heroku pg:info --app your-app-name
=== HEROKU_POSTGRESQL_GOLD_URL
Plan: Hobby-dev
Status: Available
Connections: 0
PG Version: 9.3.3
Created: 2014-05-25 14:03 UTC
Search WWH ::




Custom Search