Guest User

Untitled

a guest
Feb 20th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. desc "imports the data from backup.sql"
  2. task :db_import => :environment do
  3. filenam = 'backup.sql'
  4. production = YAML.load(File.read(File.join(RAILS_ROOT, "config/database.yml")))['production']
  5. db = production['database']
  6. username = production['username']
  7. password = production['password']
  8. %x{mysql #{db} < #{filename} -u #{username} -p#{password}}
  9. puts "====================================================="
  10. puts "Database imported successfully"
  11. puts "====================================================="
  12. end
Add Comment
Please, Sign In to add comment