Migrating a Rails project from MySQL to PostgreSQL
This brief guide is written from my own experience with migrating a large (~5GB) MySQL database to PostgreSQL for a Rails project.
No warranties, guarantees, support etc. Use at your own risk and, as always, ENSURE YOU MAKE BACKUPS FIRST!
pgloader because it's extremely fast. YMMV.
config/database.ymlfor PostgreSQL. I used Rails' template as a starting point.
rake db:createto generate your shiney new PostgreSQL DB.
- Go through
db/schema.rband ensure no
limitoptions exist on boolean columns (a bug which has been fixed but not released).
rake db:schema:loadto setup the schema.
- Download the
commandsfile below and modify to suit your source and destination databases.
apt-get install pgloader,
brew install pgloader, etc.).
pgloader --verbose commands, sit back and enjoy the show.
Please leave comments with your own experiences!