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!
Accepted Answer
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
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.