namespace :db do migrator = lambda do |version| require_relative 'db' Sequel.extension :migration Sequel::Migrator.apply(DB, 'migrate', version) end namespace :migrate do desc "Perform migration up to latest migration available" task :up do migrator.call(nil) end desc "Perform migration all the way down (erase all data)" task :down do migrator.call(0) end end desc "Erase all data, then bring back to latest migration" task :reset do migrator.call(0) Sequel::Migrator.apply(DB, 'migrate') end #desc "Migrate to a specific version" #task :migrate do |version| #end end