jngo (owner)

Revisions

gist: 48324 Download_button fork
public
Description:
Grabbing mysql production databases to your local system with rake.
Public Clone URL: git://gist.github.com/48324.git
Embed All Files: show embed
Ruby #
1
2
3
4
5
6
7
# Via Ben Scharz (http://www.germanforblack.com/2007/grabbing-mysql-production-databases-to-your-local-system-with-rake)
namespace :db do
desc "Sync your local database with a remote one REMOTE=name_of_database LOCAL=your_local_db"
  task :sync do
    `ssh domain.com "mysqldump --skip-extended-insert -u db_username -p #{ENV['REMOTE']} | bzip2 " | bzcat | mysql -u root #{ENV['LOCAL'] || "app_development"}`
  end
end