In order to migrate your Shared DB to Postgres:Dev plan on Heroku, follow these steps:
Turn on the maintance mode
λ heroku maintenance:onAdd Postgres:Dev plan to your app
λ heroku addons:add heroku-postgresql:dev
Adding heroku-postgresql:dev to YOUR_APP... done, v10 (free)
Attached as HEROKU_POSTGRESQL_xxxxxx
Database has been created and is availablewhere xxxxxx is an uniq color name e.g. GREEN, VIOLET, etc.
Backup the data
λ heroku pgbackups:capture --expire
SHARED_DATABASE (DATABASE_URL) ----backup---> b002
Capturing... done
Storing... doneIt creates a most recent backup of your database.
Restore
λ heroku pgbackups:restore HEROKU_POSTGRESQL_xxxxxx
HEROKU_POSTGRESQL_xxxxxx <---restore--- b002 (most recent)
SHARED_DATABASE (DATABASE_URL)It restores your previous backup on the new database created with Postgres:Dev plan.
Switch the database
λ heroku pg:promote HEROKU_POSTGRESQL_xxxxxx
Promoting HEROKU_POSTGRESQL_xxxxxx to DATABASE_URL... doneIt makes the new database as primary for your application. You can check if
everything is OK with heroku config.
Turn off the maintance mode
λ heroku maintenance:offIt's done, your database should be properly migrated.