Created
October 3, 2008 00:02
-
-
Save jasonrudolph/14478 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :db do | |
namespace :data do | |
desc "Load data into current environment" | |
task :load => [:environment, 'db:drop', 'db:create'] do | |
db = ActiveRecord::Base.configurations[RAILS_ENV] | |
%x( mysql -u #{db['username']} --password=#{db['password']} #{db['database']} < "#{RAILS_ROOT}/db/dump/data.sql" ) | |
end | |
desc "Dump current database schema and data to file" | |
task :dump => :environment do | |
db = ActiveRecord::Base.configurations[RAILS_ENV] | |
%x( mysqldump -u #{db['username']} --password=#{db['password']} #{db['database']} > "#{RAILS_ROOT}/db/dump/data.sql" ) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment