Hi, I'm trying to utilize AR migrations outside of a rails application as this sort of thing is valuable in just about any application using a versioned database. I have seen examples (http://blogs.pragprog.com/cgi-bin/pragdave.cgi/Tech/Ruby/MigrationsOutsideRails.rdoc) of calling AR standalone, however; I would like to leverage the up/back support that you get with AR::Migration instances.
In peeking around the AR source, I saw that the default rake task calls ActiveRecord::Migrator.migrate and passed in the scripts directory and optional version number. I created the following simple script:
require "rubygems" require_gem "activerecord"
ActiveRecord::Base.establish_connection( :adapter => "sqlserver", :host => "DBI:ADO:Provider=SQLOLEDB;Data Source=localhost;Initial Catalog=migrate_demo;User Id=someuser;Password=itsasecret;", :username => "someuser", :password => "itsasecret", :database => "migrate_demo") ActiveRecord::Migrator.migrate("db/", ARGV[0] ? ARGV[0].to_i : nil
I verified the connectivity in IRB (having patched the DBI's ado.rb) and all is well. When I run the script I get the following (long stack trace below). I'm hoping someone can with setting up AR properly. The stack trace is below... Thanks!