For years I’ve used a ssh pipe from mysqldump on the live server to mysql on my development machine for getting a copy of the current data.
ssh -C <server> mysqldump --opt <live_database_name> |mysql <local_dev_database_name>
Where -C enables ssh compression and --opt enables quickness and completeness.
Does anyone have a rails-ish equivalent rake task for this? Ideally it’d take the database names from config/database.yml
https://gist.github.com/750129
This is not an elegant solution. It’s basically a wrapper for your old method, so it’s not even compatible with other database drivers.
But it is something you can put in your SCM under lib/tasks to share it with other developers on your team. It also uses config data from your existing config/database.yml file. You define the live db by simply adding another branch to that file and it uses the same key names that Rails do.
Maybe it would even make sense to reuse the production database configuration.