1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Heroku Postgresでプランを「Hobby Dev」から「Hobby Basic」にアップグレードしたメモ

Last updated at Posted at 2018-12-23

前提

以下の続き。実際の作業のメモ。
Heroku Postgresで「PG::InsufficientPrivilege: ERROR: permission denied for relation」エラー - Qiita https://qiita.com/kure/items/ba96d5b31f5e85cfb511

新DB(Hobby Basic)を新規作成→データコピー→旧DB(Hobby Dev)を削除、な流れ

メモ

現状確認

kure@ubuntu ~/ % heroku pg:info                          
=== DATABASE_URL
Plan:                  Hobby-dev
Status:                Available
Connections:           1/20
PG Version:            10.6
Created:               2018-09-27 00:32 UTC
Data Size:             37.8 MB
Tables:                6
Rows:                  20255/10000 (Write access revoked)
Fork/Follow:           Unsupported
Rollback:              Unsupported
Continuous Protection: Off
Add-on:                postgresql-elliptical-xxxxx

新DB作成

結果「HEROKU_POSTGRESQL_COBALT_URL」が出来た。
色の名前が適当に付くらしい。

kure@ubuntu ~/x % heroku addons:create heroku-postgresql:hobby-basic
Creating heroku-postgresql:hobby-basic on ⬢ x... $9/month
Database has been created and is available
 ! This database is empty. If upgrading, you can transfer
 ! data from another database with pg:copy
Created postgresql-shaped-26200 as HEROKU_POSTGRESQL_COBALT_URL
Use heroku addons:docs heroku-postgresql to view documentation
kure@ubuntu ~/ % heroku pg:info                                    
=== DATABASE_URL
Plan:                  Hobby-dev
Status:                Available
Connections:           1/20
PG Version:            10.6
Created:               2018-09-27 00:32 UTC
Data Size:             37.8 MB
Tables:                6
Rows:                  20251/10000 (Write access revoked)
Fork/Follow:           Unsupported
Rollback:              Unsupported
Continuous Protection: Off
Add-on:                postgresql-elliptical-

=== HEROKU_POSTGRESQL_COBALT_URL
Plan:                  Hobby-basic
Status:                Available
Connections:           0/20
PG Version:            10.6
Created:               2018-12-23 14:39 UTC
Data Size:             7.7 MB
Tables:                0
Rows:                  0/10000000 (In compliance) - refreshing
Fork/Follow:           Unsupported
Rollback:              Unsupported
Continuous Protection: Off
Add-on:                postgresql-shaped-

データコピー

数秒で完了。

kure@ubuntu ~/ % heroku maintenance:on
Enabling maintenance mode for ⬢ xxxx... done
kure@ubuntu ~/ % heroku pg:copy DATABASE_URL HEROKU_POSTGRESQL_COBALT_URL
 ▸    WARNING: Destructive action
 ▸    This command will remove all data from COBALT
 ▸    Data from DATABASE will then be transferred to COBALT
 ▸    To proceed, type xxxxx or re-run this command with --confirm
 ▸    xxxx

> 
Starting copy of DATABASE to COBALT... done
Copying... done

利用するDBを変更

kure@ubuntu ~/ % heroku pg:promote HEROKU_POSTGRESQL_COBALT_URL
Ensuring an alternate alias for existing DATABASE_URL... HEROKU_POSTGRESQL_JADE_URL
Promoting postgresql-shaped-26200 to DATABASE_URL on ⬢ ... done
kure@ubuntu ~/ % heroku pg:info                                          
=== DATABASE_URL, HEROKU_POSTGRESQL_COBALT_URL
Plan:                  Hobby-basic
Status:                Available
Connections:           0/20
PG Version:            10.6
Created:               2018-12-23 14:39 UTC
Data Size:             34.5 MB
Tables:                6
Rows:                  20303/10000000 (In compliance)
Fork/Follow:           Unsupported
Rollback:              Unsupported
Continuous Protection: Off
Add-on:                postgresql-shaped-

=== HEROKU_POSTGRESQL_JADE_URL
Plan:                  Hobby-dev
Status:                Available
Connections:           1/20
PG Version:            10.6
Created:               2018-09-27 00:32 UTC
Data Size:             37.8 MB
Tables:                6
Rows:                  20247/10000 (Write access revoked)
Fork/Follow:           Unsupported
Rollback:              Unsupported
Continuous Protection: Off
Add-on:                postgresql-elliptical-

旧DBを削除

kure@ubuntu ~/x % heroku maintenance:off
Disabling maintenance mode for ⬢ ... done
kure@ubuntu ~/x % heroku addons:destroy HEROKU_POSTGRESQL_JADE_URL
 ▸    WARNING: Destructive Action
 ▸    This command will affect the app 
 ▸    To proceed, type x or re-run this command with --confirm
 ▸    x

> x
Destroying postgresql-elliptical-x on ⬢ ... done
kure@ubuntu ~/x % heroku pg:info                                  
=== DATABASE_URL, HEROKU_POSTGRESQL_COBALT_URL
Plan:                  Hobby-basic
Status:                Available
Connections:           0/20
PG Version:            10.6
Created:               2018-12-23 14:39 UTC
Data Size:             34.6 MB
Tables:                6
Rows:                  20303/10000000 (In compliance)
Fork/Follow:           Unsupported
Rollback:              Unsupported
Continuous Protection: Off
Add-on:                postgresql-shaped-x

参考

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?