Loading Heroku schema: permission denied for postgres database

I am trying to deploy my Rails application to Heroku and now I want to upload my schema. I get the following error:

Running `bundle exec rake db:schema:load` attached to terminal... up, run.1533 rake aborted! PG::ConnectionBad: FATAL: permission denied for database "postgres" DETAIL: User does not have CONNECT privilege. 

Which is strange, because postgres is not the database to which it should connect. The database URL available to the application through ENV has the correct values ​​and the apparently long random name d3kwlkwlwjwljetc...

Searching for this message gives me people trying to reset or reset the database, which is not what I am doing.

  • I have 0 lines
  • I tried pg:reset , even deleted and returned the database. No.
  • I do not do db:drop , just db:schema:load

I am stunned. Why can't my application connect?

Edit: Apparently, I cannot schema:load , but I can transfer all my migrations. Why is this?

+6
source share
1 answer

This seems to be a problem in Rails - a discussion of this issue occurs at https://github.com/rails/rails/issues/17945 - it seems that there is a fix ( https://github.com/rails/rails/blob/master /activerecord/lib/active_record/tasks/postgresql_database_tasks.rb#L77 ), which connects to the posgres database, which is not allowed on Heroku, fails.

In short, for now, use db: migrate until the problem is resolved.

+9
source

Source: https://habr.com/ru/post/980720/


All Articles