Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 585
brianrhea Avatar asked Jul 06 '18 13:07

brianrhea


People also ask

How do I upgrade my Heroku?

To upgrade via the Heroku Dashboard, navigate to your app settings page and click the Upgrade Stack button. Confirm that you want to upgrade, which will set the stack to the latest version.

How do you update data in Heroku Postgres?

Login to your Heroku account and click on the menu on the left of your profile. After that choose Data option from the dropdown menu. In a new window you will see your database running in the Heroku account. Choose the data resource you want to connect.

When using the PG upgrade to upgrade to version 13 how much app downtime is required?

If no --version flag is set, the upgrade will default to 14. Performing a pg:upgrade requires app downtime on the order of 30 minutes.


1 Answers

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

like image 106
brianrhea Avatar answered Oct 11 '22 16:10

brianrhea