Skip to content

Instantly share code, notes, and snippets.

@etozzato
Created October 30, 2009 16:44
Show Gist options
  • Save etozzato/222513 to your computer and use it in GitHub Desktop.
Save etozzato/222513 to your computer and use it in GitHub Desktop.
Rakefile for Sinatra
require 'rubygems'
require 'active_record'
require 'yaml'
require 'rake'
def initialize_active_record
config = YAML::load(IO.read(File.dirname(__FILE__) + '/database.yml'))
ActiveRecord::Base.establish_connection(config['development'])
ActiveRecord::Base.default_timezone = :utc
end
initialize_active_record
namespace :db do
desc "MIGRATE"
task :migrate do
ActiveRecord::Base.logger = Logger.new(STDOUT)
ActiveRecord::Migration.verbose = true
ActiveRecord::Migrator.migrate("db/migrate")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment