From Sqlite to Postgres
![]()
Switching from sqlite to Postgres DB in a Rails Project
(this guide is for Mac users)
- update your Gemfile
gem 'sqlite3'gem 'pg'- run
bundle
- update database.yml
development:
adapter: postgresql
encoding: unicode
database: myappname_development
pool: 5
username: simon
password:
timeout: 5000
test:
adapter: postgresql
encoding: unicode
database: myappname_test
pool: 5
username: simon
password:
timeout: 5000
- go through migration files and replace all
t.stringwitht.text - run
rails db:setup - run
rails db:migrate