How to create new database on heroku server with postgres
I want to create a PostgreSQL database on a Heroku server.
My database.yml
is
production:
adapter: postgresql
encoding: utf8
database: ddb
username: po开发者_C百科stgres
port: 5432
password: admin
host: localhost
When I run heroku rake db:create
it gives me the error:
mydatabase already exists
(in /disk1/home/slugs/181380_8d7032f_f439-4fe4f5a6-f181-4150-a968-fadcf45f0af5/mnt)
I have tried it for various different database names, but get the same message.
How can I resolve this error?
heroku autogenerates database.yml on the deploy. Reads like: it doesn't matter what you put in your database.yml, which to me is nice, as I can include it in git without worrying about production db passwords.
You may choose another database by setting the ENV['DATABASE_URL'] (use heroku config:add DATABASE_URL=....
)
Check heroku documentation https://devcenter.heroku.com/articles/ruby-support#build-behavior
精彩评论