Search code examples
herokuheroku-postgres

permission denied for database "postgres" DETAIL: User does not have CONNECT privilege


I'm trying to deploy an API to create a dev environment using heroku. I successfully pushed my project to heroku and added the add-on, but now when i try to create the database (heroku run php bin/console doctrine:database:create), i have the following error: permission denied for database "postgres" DETAIL: User does not have CONNECT privilege. I tried to find where I can change the permissions but I couldn't.


Solution

  • Heroku Postgres automatically creates the database on your behalf. To prevent accidents and other issues, creating a database is prohibited which is why you're seeing "postgres" DETAIL: User does not have CONNECT privilege.

    Instead of running heroku run php bin/console doctrine:database:create you need to run your migrations. I'm not familiar with doctrine but it might look something like heroku run php bin/console doctrine:database:execute, for example.