1

I have crm rails application deployed in heroku so my database is postgresql. I have an iphone app which is using mysql database. Now what i need to do is to synch my iphone database with my heroku database.

Can anyone please help me on this is it possible to sync two different databases in heroku

Thanks in Advance

anusha
  • 2,087
  • 19
  • 31

1 Answers1

0

The way we did this was to do it manually

Yep, it's a real pain, but at least you know it's done correctly

--

Process

For migrating from Postgres to MYSQL is as follows:

  1. "Backup" the database using pg_backups
  2. Download the backup locally
  3. In MYSQL (we used PHPMyAdmin), create a series of SQL calls to insert the respective data into the correct tables

Migrating from MYSQL to Postgres is, as much as I can determine, a similar process:

  1. Download the SQL dumps of your MYSQL DB (I only know how to do this in PHPMyAdmin)
  2. Configure those files to be "PG" ready
  3. Send the SQL to your Heroku postgres db's

--

Notes

For specifics, I only have the following:

If you dump from Heroku, you'll not get a traditional SQL file; you'll receive a .dump file. To change this, you'll need to use pg_restore in the following way:

$ cd c:/your/postgres/install/pg_restore/location
$ pg_restore path_to_your_dump.dump > path_to_your_sql.sql

This will give you the ability to "read" the file, uploading to your db & importing as you wish. That's when the fun begins :)


Importing MYSQL

The way to import MYSQL into a PG db will have to be done manually

Although we've never done this directly (we only migrated from PG), there are several things you can do. Firstly, you can use the PG2MYSQL converter to give you an idea as to the syntax differences between MYSQL & PG

Then I would perform a "dump" from MYSQL in SQL format. This will give me the data required for PG. This will allow me to insert into my PG database (you might have to do this locally to give you the ability to determine the syntax), from which you can then patch in the MYSQL data

I understand it's not the most elaborate explanation - I hope it gives you some ideas

Community
  • 1
  • 1
Richard Peck
  • 76,116
  • 9
  • 93
  • 147
  • Sorry, I have just seen your answer, so that means we need do it manually. can't it be done programmatically – anusha Aug 28 '14 at 02:57