ceritium (owner)

Revisions

gist: 198891 Download_button fork
public
Public Clone URL: git://gist.github.com/198891.git
Embed All Files: show embed
Receta capistrano para backups de mysql #
1
2
3
4
5
6
7
8
9
10
11
12
13
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