closed as off-topic by Tunaki, Paul Roub, Glorfindel, Machavity, Samuel Liew♦Feb 10 '17 at 4:34
This question appears to be off-topic. The users who voted to close gave this specific reason:
'Questions asking us to recommend or find a book, tool, software library, tutorial or other off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.' – Tunaki, Paul Roub, Glorfindel, Machavity, Samuel Liew
If this question can be reworded to fit the rules in the help center, please edit the question.
3 Answers
Faced the problem a few years ago, and used pg2mysql
EDIT 21 july 2019 : this fork seems a better option (patches, light maintenance)
Not the answer you're looking for? Browse other questions tagged mysqldatabasepostgresql or ask your own question.
Lanyrd's MySQL to PostgreSQL conversion script. Use with care.
This script was designed for our specific database and column requirements -notably, it doubles the lengths of VARCHARs due to a unicode size problem wehad, places indexes on all foreign keys, and presumes you're using Djangofor column typing purposes.
GitLab-specific changes
The gitlab branch of this fork contains the following changes made forGitLab.
Guard against replacing '0000-00-00 00:00:00' inside SQL text fields.
Replace all MySQL zero-byte string literals 0. This is safe as of GitLab6.8 because the GitLab database schema contains no binary columns.
Never set 'NOT NULL' constraints on datetimes.
Drop sequences before creating them.
Preserve default values of boolean (originally tinyint(1)) columns.
Import all indexes.
Import index names.
Drop tables before creating.
Drop indexes before creating.
How to use
First, dump your MySQL database in PostgreSQL-compatible format
Then, convert it using the dbconverter.py script.
It'll print progress to the terminal
Now we have a DB dump that can be imported but the dump will be slow dueto existing indexes. We use 'ed' to edit the DB dump file and move the'DROP INDEX' statements to the start of the import. Ed is not the fastesttool for this job if your DB dump is multiple gigabytes. (Patches tothe converter are welcome!)
Next, load your new dump into a fresh PostgreSQL database using:
psql -f databasename.psql -d gitlabhq_production
More information
You can learn more about the move which this powered at http://lanyrd.com/blog/2012/lanyrds-big-move/ and some technical details of it at http://www.aeracode.org/2012/11/13/one-change-not-enough/.