I had been using SQLite in my development environment, and PostgreSQL in the beta environment for one of my projects, until today. I decided to change to PostgreSQL.
I think it’s a good (and almost essential) practice to use the same tools/libraries on development, beta and production.
This is what I did:
1. Created two PostgreSQL databases locally (app_development & app_test) with pgAdmin3
2. Created a PostgreSQL user (app_user) with ‘create database’ privileges
3. Changed my database.yml to look like this
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | development: adapter: postgresql database: app_development username: app_user password: app_pwd timeout: 5000 encoding: utf8 test: &TEST adapter: postgresql database: app_test username: app_user password: app_pwd timeout: 5000 encoding: utf8 |
4. Ran heroku db:pull
That created all the tables in my database and pulled the data from beta.
This is a very useful way to get new development environments up and running, using Heroku.
