lib/active_wrapper/tasks.rb in winton-active_wrapper-0.1.6 vs lib/active_wrapper/tasks.rb in winton-active_wrapper-0.1.7

- old
+ new

@@ -5,21 +5,28 @@ def initialize(options={}, &block) task :environment do $db, $log = ActiveWrapper.setup(options) - $db.establish_connection yield if block end namespace :db do + desc "Create the database" + task :create do + $db.create_db + end + + desc "Drop the database" + task :drop do + $db.drop_db + end + desc "Migrate the database with optional VERSION" task :migrate => :environment do $db.migrate(ENV["VERSION"] ? ENV["VERSION"].to_i : nil) end - end - - namespace :generate do + desc "Generate a migration with given NAME" task :migration => :environment do $db.generate_migration(ENV['NAME']) end end \ No newline at end of file