migrating from SQLite to PostgreSQL via Heroku

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.

This entry was posted in developer tools, web programming and tagged , , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Spam protection by WP Captcha-Free