lib/sportdb/cli/runner.rb in sportdb-0.2.0 vs lib/sportdb/cli/runner.rb in sportdb-0.3.0
- old
+ new
@@ -18,10 +18,12 @@
cmd.banner = "Usage: sportdb [options]"
## todo: change to different flag?? use -c/--config ???
cmd.on( '-c', '--create', 'Create DB Schema' ) { opts.create = true }
+
+ cmd.on( '--delete', 'Delete all records' ) { opts.delete = true }
cmd.on( '--load', 'Use Loader for Builtin Sports Data' ) { opts.load = true }
cmd.on( '-o', '--output PATH', "Output Path (default is #{opts.output_path})" ) { |path| opts.output_path = path }
@@ -79,9 +81,13 @@
ActiveRecord::Base.establish_connection( db_config )
if opts.create?
CreateDB.up
+ end
+
+ if opts.delete?
+ SportDB.delete!
end
loader = nil
if opts.load?
loader = Loader.new
\ No newline at end of file