How to create new database on heroku server with postgres
15,588
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
Author by
Jayashri
Updated on June 04, 2022Comments
-
Jayashri almost 2 years
I want to create a PostgreSQL database on a Heroku server.
My
database.yml
isproduction: adapter: postgresql encoding: utf8 database: ddb username: postgres 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?