Reputation: 5603
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.
Upvotes: 1
Views: 1670
Reputation: 8695
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
.
Upvotes: 1
Reputation: 10769
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
Upvotes: 14