Super Simple Rails Database Data Dump
So after searching for a long time and trying to become an expert using mysqldump, I have found, yaml_db.
yaml_db is the easiest, fastest, most reliable way to transfer your production data to your development database and vice versa. It runs a rake task that pushes everything into a file called data.yaml, then loads it back into another database using a similiar rake task.
Dump :: rake db:data:dump
Load :: rake db:data:load
It’s that easy and it works!
I copied a MySQL production database to my development machine and this worked in all of 5 minutes. Remember, this is only transferring data, not schema or structure! This is great, since Rails handles that using migrations. mysqldump always seems to screw up my structure if I don’t use the right encoding and params, but this works like a charm.
The only trick is that once you dump the data, you will have scp it to your local machine with something like
scp -P [PORT] user@domain:/path/to/railsapp/current/db/data.yml \ /User/local/username
I wrote some capistrano tasks to handle that for me.
That’s it! Great job Heroku! Wonderful plugin.