Skip to content

Instantly share code, notes, and snippets.

@ceritium
Created October 1, 2009 10:53
Show Gist options
  • Save ceritium/198891 to your computer and use it in GitHub Desktop.
Save ceritium/198891 to your computer and use it in GitHub Desktop.
before "deploy:migrate", 'db:backup'
namespace :db do
desc "Crea un backup de la base de datos antes de correr migraciones"
task :backup do
run "mkdir -p #{current_path}/db/backups"
run "mysqldump -u root -p #{application}_production | gzip > #{current_path}/db/backups/#{application}_production_#{Time.now.strftime '%Y%m%dT%:%H%M%S'}.gzip" do |ch, stream, out|
ch.send_data "the password" if out == "Enter password: "
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment