1

I am using postgresql and have been operating under my local dev environment. I deployed my app to Heroku, and now I need to setup heroku to use a database just like I have locally.

Locally, I would run this:

rake db:create
rake db:migrate

On heroku, I tried the same thing:

heroku run rake db:create

However, that returns this error:

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

Couldn't create database for {"adapter"=>"postgresql", "username"=>"stegjyxfak", "password"=>"wB-Yfh450945jI5UrnFjxdwZ_o4N5", "port"=>5432, "database"=>"d64phj348vgdg5hm", "host"=>"ec2-107-20-191-205.compute-1.amazonaws.com"}

What should I be running to get my heroku DB setup? I am using Rails 4.0 if that is relative.

2

2 Answers 2

14

You should use migrate instead of create:

heroku run rake db:migrate

https://devcenter.heroku.com/articles/getting-started-with-rails4#deploy-your-application-to-heroku

Sign up to request clarification or add additional context in comments.

Comments

1

Directly destructive commands (drop and create) are not permitted on heroku. But if you're ok with loosing all the data, you can reset the database with pg:reset.

Every other change should be done with db:migrate. If your migrations don't run through the full stack anymore you can also use db:schema:load but be aware that this can be destructive if create_table has set force: true or force: :cascade.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.