我把Heroku Postgres的计划从“Hobby Dev”升级至“Hobby Basic”,记录如下
前提 – 翻译成中文:The premise
以下是继续。实际工作记录。Heroku Postgres出现了”PG::InsufficientPrivilege: ERROR: permission denied for relation”错误 – Qiita网站 https://qiita.com/kure/items/ba96d5b31f5e85cfb511
创建新的DB(爱好基础版)→复制数据→删除旧的DB(爱好开发版)。
写字板
确认目前的情况
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
创建新的数据库
最终结果是创建了一个名为「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
更改使用的数据库
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-
删除旧的数据库
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