nullif fixes raw person import

This commit is contained in:
Raphael 2011-01-06 15:16:32 -08:00
parent 283a5501be
commit 770e90064d
2 changed files with 7 additions and 3 deletions

View file

@ -128,7 +128,8 @@ module DataConversion
#{load_string("people")}
#{infile_opts}
(created_at,updated_at,serialized_public_key,url,mongo_id,@owner_mongo_id_var,diaspora_handle)
SET owner_mongo_id = @owner_mongo_id_var
SET guid = mongo_id,
owner_mongo_id = NULLIF(@owner_mongo_id_var, '');
SQL
log "Finished. Imported #{Mongo::Person.count} people."
end

View file

@ -158,9 +158,12 @@ describe DataConversion::ImportToMysql do
it "imports all the columns" do
@migrator.import_raw_people
person = Mongo::Person.first
pp person
person.owner_mongo_id.should be_nil
person.mongo_id.should == "4d26212bcc8cb44df200000d"
person.mongo_id.should == "4d26212acc8cb44df2000002"
person.guid.should == person.mongo_id
person.url.should == "http://google-1b5b16a.com/"
person.diaspora_handle.should == "bob-person-1a8bc18@aol.com"
person.serialized_public_key.should_not be_nil
person.created_at.should be_nil
end
end