A civic-minded citizen seeking the singularity

An entry

Migrating from MySQL to PostgreSQL

Date: 2015-12-13
Status: release
Tags: ruby rails data

I recently moved from a self-hosted MySQL database to a free instance of Postgres on Heroku.

This entailed getting the data from the MySQL database into the Postgres database. I found the yaml_db .gem particularly useful here.

  1. run rake db:data:dump to create a db/data.yml file of all the data in your database
  2. change database.yml to the new database's URL - something like postgres://...amazonaws.com...
  3. run rake db:data:load to load the db/data.yml file into the Postgres database