Sha256: 7dac7b4f8e2ecae771f87e222a8a37b04addb87c90f3ea4527a9b1c998244b16
Contents?: true
Size: 967 Bytes
Versions: 3
Compression:
Stored size: 967 Bytes
Contents
if File.exist? Rails.root.join('config/database.yml') namespace :mysql do config = YAML.load(File.read(Rails.root.join('config/database.yml')))[Rails.env.to_s] db = config['database'] host = config['host'] FileUtils.mkdir_p Rails.root.join('mysql') backup = "mysqldump -h #{host} #{db} > #{Rails.root}/mysql/dump.sql" desc backup task :dump do zfben_rails_rake_system backup end restore = "mysql -h #{host} #{db} < #{Rails.root}/mysql/dump.sql" desc restore task :restore => 'db:create' do zfben_rails_rake_system restore end backup_all = "mysqldump -h #{host} --all-databases > #{Rails.root}/mysql/dump_all.sql" desc backup_all task :dump_all do zfben_rails_rake_system backup_all end restore_all = "mysql -h #{host} < #{Rails.root}/mysql/dump_all.sql" desc restore_all task :restore_all => 'db:create' do zfben_rails_rake_system restore_all end end end
Version data entries
3 entries across 3 versions & 1 rubygems