Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
261 views
in Technique[技术] by (71.8m points)

Upgrade hobby-dev to hobby-basic on Heroku

I'm still getting my head wrapped around Heroku's plans. But I know I'm going to have around 3M rows in the db so I need to upgrade from hobby-dev to hobby-basic.

However, I can't find any documentation or help about this level of upgrade. Only docs to go from Hobby to Standard.

Do I need to create a new PG Add-On and then wipe out my hobby-dev db?

question from:https://stackoverflow.com/questions/51211921/upgrade-hobby-dev-to-hobby-basic-on-heroku

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

This answer assumes that you're using Heroku CLI. Any instance of "YOUR_APP_NAME" in a command should be replaced by the application name of the Heroku App you're working with.

You will also need on hand the connection URL (shown here as DATABASE_URL) of your current hobby-dev database to be upgraded.

1. Provision a new hobby-basic database:

heroku addons:create heroku-postgresql:hobby-basic -a YOUR_APP_NAME

This will output a name for the new database containing a color. You will need to refer to this later. For example:

HEROKU_POSTGRESQL_PINK_URL

2. Optionally put db into maintenance mode to ensure that no data is added to the db while it's being copied.

heroku maintenance:on --app YOUR_APP_NAME

3. Copy the existing hobby-dev db to the hobby-basic db

heroku pg:copy DATABASE_URL HEROKU_POSTGRESQL_PINK --app YOUR_APP_NAME

Heroku will now print the following message.

heroku pg:copy DATABASE_URL HEROKU_POSTGRESQL_PINK --app YOUR_APP_NAME

!    WARNING: Destructive Action
!    Transfering data from DATABASE_URL to HEROKU_POSTGRESQL_PINK
!    This command will affect the app: YOUR_APP_NAME
!    To proceed, type "YOUR_APP_NAME" or re-run this command with --confirm YOUR_APP_NAME

YOUR_APP_NAME

4. Confirm db transfer by typing the actual name of your application

YOUR_APP_NAME

5. Promote your new database

heroku pg:promote HEROKU_POSTGRESQL_PINK --app YOUR_APP_NAME

The color-based name of the database you promote should be copied from the output you got up in step 1. Do not copy and paste the line above word for word, it will not work.

6. If you put your db into maintenance mode earlier, turn it off.

heroku maintenance:off --app YOUR_APP_NAME


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...