Sha256: da3352b40c4ac5a2765beb12d053ab6798273fa5b748fe96af61b0ed2a7ce2c0
Contents?: true
Size: 1.24 KB
Versions: 1
Compression:
Stored size: 1.24 KB
Contents
namespace :load do task :defaults do set :db_roles, -> { :db } set :db_backup_on_deploy, -> { false } end end namespace :db do desc "seed the database" task :seed do on release_roles fetch(:db_roles) do within current_path do execute :bundle, :exec, :rake, "db:seed RAILS_ENV=#{fetch(:stage)}" end end end desc 'Dumb database and download yaml file' task :yaml_dumb do # create local backup-dir if not existing run_locally do execute :mkdir, "-p db/backups" end # download yaml version of current DB on roles :db do within current_path do execute :bundle, :exec, :rake, "db:data:dump RAILS_ENV=#{fetch(:stage)}" # => download! "#{current_path}/db/data.yml", "db/backups/#{ Time.now.strftime("%y-%m-%d_%H-%M") }_#{fetch(:stage)}_db_data.yml" execute "tar -czvf #{current_path}/db/data-dumb.tar.gz #{current_path}/db/data.yml" download! "#{current_path}/db/data-dumb.tar.gz", "db/backups/#{ Time.now.strftime("%y-%m-%d_%H-%M") }_#{fetch(:stage)}_db_data.tar.gz" end end end end namespace :deploy do before :starting, :backup_database do if fetch(:db_backup_on_deploy) invoke "db:yaml_dumb" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
magic_recipes_two-0.0.52 | lib/capistrano/tasks/db.rake |