Migrating from MySQL to PostgreSQL
When you come, like me, from a LAMP background, using MySQL as backend for DBMail seems natural.
As your database grows, little things at the edge of your mind start nagging you, or you've grown to like and appreciate PostgreSQL's more mature feature set. Or maybe you just dis-like Oracle.
Migrating from MySQL to PostgreSQL is no simple feat. Typically, MySQL is very lax when it comes to accepting encoded strings. And this will bite you when you try to load a SQL dump from MySQL into PostgreSQL. And bite you hard it will. Especially if your DBMail database, like mine, dates back many years.
I started working on some migration script that lives in contrib/sql2sql/mysql2pgsql.sh. It's old and unfinished, because last time I tried to migrate my main dog-food installation, I failed.
But those little things kept nagging at me, so I started anew. And this time I was successful.
The mysql2pgsql.sh script will now simply work, though you will have to install a pre-requisite (py-mysql2pgsql), and edit the yaml file included in the .../sql2sql/ directory.
You will also want to shutdown your email services, because the export/import is not atomic.
happy migration!
Paul J. Stevens leads the open-source DBMail community. Paul has a master of science in Cultural Anthropology.
