postgresqlherokuyamlruby-on-rails-4.2heroku-postgres

Heroku PostgreSQL user and database creation


Currently I have my Ruby on Rails program running great on my Linux Ubuntu development environment, and now I want to run it live on my website, and get it hosted on Heroku.

The problem is that I don't know how to create a user and a database on Heroku. I have tried the command

heroku run rake db:create

I got the error:

permission denied for database - user does nothave connect privilage

I also tried the command

heroku run su - postgres

and it posted that I need to use the terminal so I do not know how to proceed.

This is my database.yml

default: &default
  adapter:  postgresql
  host:     localhost

development:
  <<: *default
  database: app_development

test:
   <<: *default
   database: app_test

production:
  <<: *default
  database: app_production

How do I set up my database and the proper connections with my Heroku PostgreSQL database?

i also did this

heroku pg:info 

which gave me this

shrouded-reaches-3063 has no heroku-postgresql databases.

also tried this

heroku addons | grep POSTGRES

but nothing was printed

heroku addons:create heroku-postgresql:hobby-dev 
!    `addons:create` is not a heroku command.
!    See `heroku help` for a list of available commands.

also this

heroku pg:wait

and displayed nothing... this really is something T_T really need some major help here , and will be really greatful for any help


Solution

  • Have you provisioned a database? What does heroku addons say? You can create an add-on as documented here with heroku addons:create heroku-postgresql:hobby-dev