Converting Rails from sqlite3 to PostgreSQL
Your mod 3 and 4 projects were probably done using sqlite3. If you did your mod5 project in sqlite3, tsk tsk!
- edit your Gemfile
- comment out sqlite and add gem pg
- run “bundle install”
- edit
config/database.yml
- Change your databases names, as below.
- run
rake db:create
- run
rake db:migrate
- run
rake db:seed
(if you have a seed file) - Now test your app, and you are now using Postgres!
How do I know that it worked?
- Go to the little Postgres elephant, and click him
- Press stop
- If your site does not work, then you migrated successfully. Refresh your browser if needed
- Now start up Postgres so you can continue developing!