I've found info explaining how to set up a Rails application from the beginning using a PostgreSQL database. But I have an application already built. Any advice on steps to take to change my existing application to use PostgreSQL rather than SQLite?
If you're using Rails 6+ you can do this:
rails db:system:change --to=postgresql
where postgresql would be the DB you want.
This was enabled by this commit.
Install the pg gem in your Gemfile
gem 'pg'
change the database.yml file to use your database ex.
adapter: postgresql
database: db_name
pool:
timeout:
host: localhost
username: username
password: password
db_name, username, and password values are what you have set your postgresql database too
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With