namespace :db do

desc "Run the DB scrubber and push to S3"
task :scrub do
  on primary(fetch(:brillo_role)) do
    with rails_env: fetch(:stage) do
      within current_path do
        execute :rake, 'db:scrub'
      end
    end
  end
end

desc "Run the S3 scrubbed DB loader"
task :load do
  raise "Don't you dare!" if fetch(:stage) == "production"
  on release_roles(:all).sample do
    with rails_env: fetch(:stage) do
      within current_path do
        execute :rake, 'db:load'
      end
    end
  end
end

end

namespace :load do

task :defaults do
  set :brillo_role, :batch
end

end