升級後的Heroku DB葛蕾:
1. heroku config
It will show current database URL
HEROKU_POSTGRESQL_COPPER_URL: postgres://xxxddxxdx:[email protected]:5432/xdfdsxdxxxx
HEROKU_POSTGRESQL_SILVER_URL: postgres://fasdfsad:[email protected]:5432/sdfasdfdasfds
//Default database set
DATABASE_URL: postgres://fasdfsad:[email protected]:5432/dsfsdf
//從命令添加新的數據庫,但我會在r命令服務器資源節去,然後單擊編輯附加組件,添加的pgsql和更改免費飛機您所需的計劃。
2. heroku addons:create heroku-postgresql:hobby-basic
//Prevent new database updates
3. heroku maintenance:on
//Also off worker type dyno
heroku ps:scale worker=0
複製當前分貝到新的數據庫
4. heroku pg:copy DATABASE_URL HEROKU_POSTGRESQL_COPPER_URL --app prod-test
heroku pg:copy DATABASE_URL HEROKU_POSTGRESQL_COPPER_URL --app prod-test
Note:
DATABASE_URL = It is config veriable which point default current db
HEROKU_POSTGRESQL_COPPER_URL = This is config variable for which db I just created
prod-test = It is my APP name
5. Promote new database (Make new db as default db)
heroku pg:promote HEROKU_POSTGRESQL_COPPER_URL
6. Re-enable worker dyno
heroku ps:scale worker=1
heroku maintenance:off
7. remove old database
heroku addons:remove HEROKU_POSTGRESQL_SILVER_URL
謝謝!現在我覺得在谷歌吸吮愚蠢。 – 2013-03-19 16:22:10