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
@akonwi
akonwi / gist:6002004
Created July 15, 2013 17:59
Secure copy over ssh
## Download
scp user@remote_host:remote_file local_file
## Upload
scp local_file user@remote_host:remote_file
@akonwi
akonwi / production_db
Created May 22, 2013 04:02
Create production database locally in rails
Run in command line:
RAILS_ENV=production rake db:create db:schema:load