Slides from talk on legacy data migration. Includes introduction of Trucker gem and covers common migration issues.
This talk was given by Patrick Crowley and Rob Kaufman at RubyMidwest 2010 in Kansas City, MO.
33. $ rake db:migrate:posts
Migrating all posts (1/10)
Migrating all posts (2/10)
Migrating all posts (3/10)
Migrating all posts (4/10)
Migrating all posts (5/10)
Migrating all posts (6/10)
Migrating all posts (7/10)
Migrating all posts (8/10)
Migrating all posts (9/10)
Migrating all posts (10/10)
38. namespace :db do
namespace :migrate do
desc 'Migrate pain_in_the_ass model'
task :pain_in_the_ass => :environment do
Trucker.migrate :pain_in_the_ass, :helper => pain_in_the_ass_migration
end
end
end
def pain_in_the_ass_migration
# Custom code goes here
end
47. • There are about 12 adapters in
the wild for pure ActiveRecord
• The ActiveRecord adapter for
sqlserver runs on Win/Unix,
but Unix setup is complicated
• Text adapter does CSV, Tab,
and other plain text formats
53. • Download MSSQL driver
(Google for it, they move it
around a lot)
• Copy sqljdbc4.jar into
RAILS_ROOT/lib
• Add require 'lib/sqljdbc4.jar' at
the top of your environment.rb
or application.rb