I'm using heroku to deploy my Django project. Since I bought a new Mac, it is a history and a brief explanation memo when upgrading the instance of Postgre (Is it AddOn for heroku) from the state where heroku CLI is not included.
hobby-dev Number of free records: 10,000 (from here) hobby-basic $ 9 / month Records: 10 million (upgrade here)
MacOS Mojave
$brew install heroku/brew/heroku
$heroku login
$heroku list
=== ****@gmail.com Apps
****1
****2
****3
****4
Now you know the app name.
Replace the corresponding app name found in step 2 with "
The app name is something like "**** 1".
//Check the status of the app
$heroku pg:info -a <app name>
//Create a new database instance
$heroku addons:create heroku-postgresql:hobby-basic -a <app name>
The environment variable name "HEROKU_POSTGRESQL _ ******_ URL" that appears in ↑ will be used immediately.
//Don't break the DB? Temporary suspension
$heroku pg:wait -a <app name>
//Turn on project maintenance mode
$heroku maintenance:on -a <app name>
The following is a little careful. This command copies and pastes information from the existing database to the new database.
//Copy the information from the existing database to the new database
$heroku pg:copy DATABASE_URL as HEROKU_POSTGRESQL_******_URL -a <app name>
Since the "******" part of the environment variable name in ↑ was different from the article I saw, it is useless to copy and paste as it is, so it is necessary to check the environment variable name and customize the copy and paste.
//Connect your Django project to your new DB.
$heroku pg:promote HEROKU_POSTGRESQL_******_URL -a <app name>
//Connection confirmation
$heroku pg:info -a <app name>
//Release maintenance mode
$heroku maintenance:off -a <app name>
Heroku CLI installation and initial setup https://blog.katsubemakito.net/macos/setup_heroku-cli
Heroku operation CLI https://qiita.com/ntkgcj/items/9e812220881d671b6bff
Upgrade heroku postgresql https://qiita.com/ozepon/items/6cc30737e96f01b4da67
Upgrade Heroku's PostgresQL from free hobby-dev to $ 9 / month hobby-basic [LGT Moon] https://www.utakata.work/entry/20190226/1551145958