Skip to content

Instantly share code, notes, and snippets.

@michaelklishin
Created August 14, 2008 20:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michaelklishin/5477 to your computer and use it in GitHub Desktop.
Save michaelklishin/5477 to your computer and use it in GitHub Desktop.
namespace :db do
task :merb_start do
Merb.start :adapter => 'runner', :environment => ENV['MERB_ENV'] || 'development', :log_file => Merb::Config[:log_file]
end
desc "Migrate the database through scripts in schema/migrations. Target specific version with VERSION=x"
task :migrate => :merb_start do
config = Merb::Orms::ActiveRecord.configurations[Merb.environment.to_sym]
ActiveRecord::Base.establish_connection(config)
ActiveRecord::Migrator.migrate("schema/migrations/", ENV["VERSION"] ? ENV["VERSION"].to_i : nil)
Rake::Task["db:schema:dump"].invoke if ActiveRecord::Base.schema_format == :ruby
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment