Created
October 30, 2009 16:44
-
-
Save etozzato/222513 to your computer and use it in GitHub Desktop.
Rakefile for Sinatra
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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