Hi guys im new in Digital Ocean and im trying to deploy a personal project. My issue happens when i try to migrate into a production database in a droplet rails app
This is my database.YML
default: &default
adapter: postgresql
encoding: unicode
pool: <%= ENV.fetch(“RAILS_MAX_THREADS”) { 5 } %>
production:
<<: *default
secret_key_base: <%= ENV[“SECRET_KEY”] %>
username: <%= ENV[“DATABASE_USER”] %>
password: <%= ENV[“DATABASE_PASSWORD”] %>
database: <%= ENV[“DATABASE”] %>
host: <%= ENV[“DATABASE_HOST”] %>
these are the steps im following
- Cd Into rails app on VM
- rails s -d -b 0.0.0.0 RAILS_ENV=production
At this point the production server is “online”
then i want to get migrations by running this:
- rake db:migrate RAILS_ENV=production
and this is the issue:
Caused by:PG::ConnectionBad: FATAL: database “root” does not exist
Rails -v 6.0.3.4
Ruby -v 2.7.1
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Enter your email to get $200 in credit for your first 60 days with DigitalOcean.
New accounts only. By submitting your email you agree to our Privacy Policy.
Hi there,
The error that you are getting indicates that you’ve defined
root
as the database that you want to use, but that database does not seem to exist.What I could suggest is:
For more information on how to do that you can follow the steps here:
https://docs.digitalocean.com/products/databases/postgresql/how-to/manage-users-and-databases/
Best,
Bobby