Here is the workaround that I’ve come up with for our review apps that use a database backup, through pg:backups:restore
( might want to enable meaintenance if you’re manipulating a production database):
-
Copy your review app database locally (one that was recently restored through
pg:backups:restore
so you get all the data):heroku pg:pull [Database URL] localdb -a [app-name]
-
Set your application database config to use
localdb
then connect to psql and execute :ALTER EXTENSION "hstore" SET SCHEMA heroku_ext;
. Run this command for all your existent extensions.
To list all the available extensions that you’ve pulled run \dx
. You don’t have to change plpgsql
it’s native to PostgreSQL
This will work because locally you have all privileges.
-
push this version back to your review app:
heroku pg:push mylocaldb [Database URL] -a [app-name]
==> Your database needs to be empty to perform this. You can try this operation on a fresh review app with empty data. this way it can become your new base for all review apps -
Make sure everything works as expected (data properly restored). Then what you can do is generate a new database dump through
pg:backups:capture
, and use that as your new go-to database backup for all your new review apps.
Source: https://devcenter.heroku.com/articles/managing-heroku-postgres-using-cli
I also had to do this because for example DROPPING the hstore
extension and reenabling it was not a viable option for our case.