Richlewis
Richlewis

Reputation: 15384

Setting up PostgresQL on Heroku Rails 4

its been a while since i have used postgresql and deployed an app to Heroku, think I have made an error somewhere with my setup.

I have created my app on Heroku, there is a Hobby Dev database setup (I ran Heroku run rake db:setup) which set up my database, but I'm wondering in my database.yml file do i have an error

default: &default
adapter: postgresql
encoding: unicode
# For details on connection pooling, see rails configuration guide
# http://guides.rubyonrails.org/configuring.html#database-pooling
pool: 5

production:
<<: *default
database: my_app_production
username: my_app
password: <%= ENV['MY_APP_DATABASE_PASSWORD'] %>

When I run heroku run rake db:create i get

 FATAL:  permission denied for database
 DETAIL:  User does not have   CONNECT privilege.

Couldn't create database for {"adapter"=>"postgresql", "encoding"=>"unicode", "pool"=>5, "database"=>"databaseName", "username"=>"userName", "password"=>"password", "port"=>5432, "host"=>"hostNamehere"}

I have set the database password using heroku config:set

What have i missed here?

Thanks

Upvotes: 1

Views: 157

Answers (1)

eugen
eugen

Reputation: 9226

Heroku ignores your database.yml configuration, they generate one when you deploy your application and they also take care of database creation. All you need to do is heroku run rake db:migrate and maybe a heroku run rake db:seed in case you need to seed your database.

Upvotes: 4

Related Questions