Skip to content

Instantly share code, notes, and snippets.

# With these tasks you can:
# - dump your production database and save it in shared_path/db_backups
# - download most recent backup
namespace :db do
task :backup_name, :roles => :db, :only => { :primary => true } do
now = Time.now
run "mkdir -p #{shared_path}/db_backups"
backup_time = [now.year,now.month,now.day,now.hour,now.min,now.sec].join('-')
set :backup_file, "#{shared_path}/db_backups/#{application}-snapshot-#{backup_time}.sql"
end