Skip to content

Instantly share code, notes, and snippets.

@sur
Created September 25, 2008 09:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sur/12792 to your computer and use it in GitHub Desktop.
Save sur/12792 to your computer and use it in GitHub Desktop.
desc "imports the data from backup.sql"
task :db_import => :environment do
filenam = 'backup.sql'
production = YAML.load(File.read(File.join(RAILS_ROOT, "config/database.yml")))['production']
db = production['database']
username = production['username']
password = production['password']
%x{mysql #{db} < #{filename} -u #{username} -p#{password}}
puts "====================================================="
puts "Database imported successfully"
puts "====================================================="
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment