lib/tasks/db.rake in db-sync-0.0.12 vs lib/tasks/db.rake in db-sync-0.0.13
- old
+ new
@@ -1,16 +1,18 @@
namespace :db do
namespace :sync do
- desc 'Download data from the databse into files.'
+ desc 'Download data from the databse into files. [commit=true/false tables=table1,table2]'
task down: :environment do
- synchronizer = Db::Sync.new(sync_dir)
+ tables = ENV['tables'].present? ? ENV['tables'].split(',') : nil
+ synchronizer = Db::Sync.new(sync_dir, tables)
synchronizer.sync_down
end
- desc 'Upload data from the files into the database.'
+ desc 'Upload data from the files into the database. [commit=true/false tables=table1,table2]'
task up: :environment do
+ tables = ENV['tables'].present? ? ENV['tables'].split(',') : nil
commit = ENV['commit'].present? ? ENV['commit'] == 'true' : nil
- synchronizer = Db::Sync.new(sync_dir)
+ synchronizer = Db::Sync.new(sync_dir, tables)
sync_up_and_print(synchronizer, commit)
if commit.nil? && synchronizer.log.present?
print "Commit Changes? [y/n]\n"
sync_up_and_print(synchronizer, true) if STDIN.gets.chomp == 'y'
end