serialized hashes need a NULLIF, as do many other fields, probably
This commit is contained in:
parent
89a41826c1
commit
abdb5f7587
2 changed files with 7 additions and 5 deletions
|
|
@ -75,8 +75,9 @@ module DataConversion
|
||||||
Mongo::Comment.connection.execute <<-SQL
|
Mongo::Comment.connection.execute <<-SQL
|
||||||
#{load_string("comments")}
|
#{load_string("comments")}
|
||||||
#{infile_opts}
|
#{infile_opts}
|
||||||
(mongo_id, post_mongo_id, person_mongo_id, @diaspora_handle, text, youtube_titles)
|
(mongo_id, post_mongo_id, person_mongo_id, @diaspora_handle, text, @youtube_titles)
|
||||||
SET guid = mongo_id;
|
SET guid = mongo_id,
|
||||||
|
youtube_titles = NULLIF(@youtube_titles, '');
|
||||||
SQL
|
SQL
|
||||||
log "Finished. Imported #{Mongo::Comment.count} comments."
|
log "Finished. Imported #{Mongo::Comment.count} comments."
|
||||||
end
|
end
|
||||||
|
|
@ -85,8 +86,9 @@ module DataConversion
|
||||||
Mongo::Post.connection.execute <<-SQL
|
Mongo::Post.connection.execute <<-SQL
|
||||||
#{load_string("posts")}
|
#{load_string("posts")}
|
||||||
#{infile_opts}
|
#{infile_opts}
|
||||||
(youtube_titles,@pending,created_at,@public,updated_at,status_message_mongo_id,caption,remote_photo_path,remote_photo_name,random_string,image,mongo_id,type,diaspora_handle,person_mongo_id,message)
|
(@youtube_titles,@pending,created_at,@public,updated_at,status_message_mongo_id,caption,remote_photo_path,remote_photo_name,random_string,image,mongo_id,type,diaspora_handle,person_mongo_id,message)
|
||||||
SET guid = mongo_id,
|
SET guid = mongo_id,
|
||||||
|
youtube_titles = NULLIF(@youtube_titles, ''),
|
||||||
#{boolean_set("pending")},
|
#{boolean_set("pending")},
|
||||||
#{boolean_set("public")};
|
#{boolean_set("public")};
|
||||||
SQL
|
SQL
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ describe DataConversion::ImportToMysql do
|
||||||
comment.text.should == "Hey me!"
|
comment.text.should == "Hey me!"
|
||||||
comment.person_mongo_id.should == "4d26212bcc8cb44df2000014"
|
comment.person_mongo_id.should == "4d26212bcc8cb44df2000014"
|
||||||
comment.post_mongo_id.should == "4d262132cc8cb44df2000025"
|
comment.post_mongo_id.should == "4d262132cc8cb44df2000025"
|
||||||
comment.youtube_titles.should == ""
|
comment.youtube_titles.should be_nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
describe "contacts" do
|
describe "contacts" do
|
||||||
|
|
@ -136,7 +136,7 @@ describe DataConversion::ImportToMysql do
|
||||||
it "imports all the columns" do
|
it "imports all the columns" do
|
||||||
@migrator.import_raw_posts
|
@migrator.import_raw_posts
|
||||||
post = Mongo::Post.first
|
post = Mongo::Post.first
|
||||||
post.youtube_titles.should == {}
|
post.youtube_titles.should be_nil
|
||||||
post.pending.should == false
|
post.pending.should == false
|
||||||
post.created_at.to_i.should == 1294358525000
|
post.created_at.to_i.should == 1294358525000
|
||||||
post.public.should == false
|
post.public.should == false
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue