Migrating data from MySQL-based Rails to Postgres SQL for use with Heroku

I have a RAILS 3.x application developed locally using MySQL that has data that requires migration. Now I want to deploy to Heroku, which uses Postgresql, and also transfers data.

The problem is the processing of columns with NULL data that the import process is not possible.

I tried to use several different strategies, such as

  • yaml_db gem - not imported at all
  • rails-backup-migrate gem - do not like the NULL encoded element;
  • taps - import failure without special details

Has anyone tried any other strategies, gems or methods? Should I just start from the local Postgresl database?

thanks in advance grant

+7
source share
2 answers

Should I just start from the local Postgresl database?

Heroku recommends using Postgres for local development.

Your production and production environment should be as close to identical as possible. This prevents complex diagnostics of errors arising from minor differences between environments. Each Heroku application comes with a PostgreSQL database as the default SQL database. Therefore, you should use PostgreSQL for your local development database. ( http://devcenter.heroku.com/articles/rails3 )

A quick search showed this:

http://wiki.postgresql.org/wiki/Converting_from_other_Databases_to_PostgreSQL#MySQL

Good luck

+2
source

I also had this problem, and found this stone on the blog .

It says that you can use gem called Valkyrie to transfer data from a MySQL database to a PostgreSQL database. You just need to install the gem using gem install valkyrie and then use the following command:

 valkyrie mysql:// datachomp@localhost /seppuku?password=QuickAndPainless postgres:// datachomp@127.0.0.1 /seppuku 
0
source

All Articles