Found problem in notification import, need to finish post and notification polymorphic stuff

This commit is contained in:
Raphael 2011-01-10 16:57:15 -08:00
parent c90f3cb1ef
commit f1e8b5c01d
4 changed files with 9 additions and 7 deletions

View file

@ -31,7 +31,7 @@ module DataConversion
:mongo_attrs => ["_id" , "to_id" , "from_id" , "into_id" , "message"]}, :mongo_attrs => ["_id" , "to_id" , "from_id" , "into_id" , "message"]},
{:name => :notifications, {:name => :notifications,
:attrs => ["mongo_id", "target_mongo_id", "recipient_mongo_id", "actor_mongo_id", "action", "target_type", "unread"], :attrs => ["mongo_id", "target_mongo_id", "recipient_mongo_id", "actor_mongo_id", "action", "target_type", "unread"],
:mongo_attrs => ["_id" , "target_id" , "recipient_id" , "actor_id" , "action", "kind" , "unread"]}, :mongo_attrs => ["_id" , "target_id" , "user_id" , "person_id" , "action", "kind" , "unread"]},
{:name => :people, {:name => :people,
:attrs => ["created_at", "updated_at", "serialized_public_key", "url", "mongo_id", "owner_mongo_id", "diaspora_handle"], :attrs => ["created_at", "updated_at", "serialized_public_key", "url", "mongo_id", "owner_mongo_id", "diaspora_handle"],
:profile_attrs => ["image_url_medium", "searchable", "image_url", "person_mongo_id", "gender", "diaspora_handle", "birthday", "last_name", "bio", "image_url_small", "first_name"]}, :profile_attrs => ["image_url_medium", "searchable", "image_url", "person_mongo_id", "gender", "diaspora_handle", "birthday", "last_name", "bio", "image_url_small", "first_name"]},

View file

@ -424,7 +424,7 @@ module DataConversion
Mongo::Notification.connection.execute <<-SQL Mongo::Notification.connection.execute <<-SQL
#{load_string("notifications")} #{load_string("notifications")}
#{infile_opts} #{infile_opts}
(mongo_id,target_mongo_id,target_type,@unread) (mongo_id,target_mongo_id,recipient_mongo_id,actor_mongo_id,@null_action,action,@unread)
SET #{boolean_set("unread")}; SET #{boolean_set("unread")};
SQL SQL
log "Finished. Imported #{Mongo::Notification.count} notifications." log "Finished. Imported #{Mongo::Notification.count} notifications."

View file

@ -1,3 +1,3 @@
mongo_id,target_id,target_type,unread mongo_id,target_mongo_id,recipient_mongo_id,actor_mongo_id,action,target_type,unread
4d2b6eb8cc8cb43cc200001f,4d2b6eb8cc8cb43cc200001e,new_request,true 4d2b6eb8cc8cb43cc200001f,4d2b6eb8cc8cb43cc200001e,4d2b6eb7cc8cb43cc2000018,4d2b6eb7cc8cb43cc2000017,,new_request,true
4d2b6ec4cc8cb43cc200003b,4d2b6ec4cc8cb43cc200003a,new_request,true 4d2b6ec4cc8cb43cc200003b,4d2b6ec4cc8cb43cc200003a,4d2b6eb6cc8cb43cc200000b,4d2b6ec2cc8cb43cc2000034,,new_request,true

1 mongo_id target_id target_mongo_id recipient_mongo_id actor_mongo_id action target_type unread
2 4d2b6eb8cc8cb43cc200001f 4d2b6eb8cc8cb43cc200001e 4d2b6eb8cc8cb43cc200001e 4d2b6eb7cc8cb43cc2000018 4d2b6eb7cc8cb43cc2000017 new_request true
3 4d2b6ec4cc8cb43cc200003b 4d2b6ec4cc8cb43cc200003a 4d2b6ec4cc8cb43cc200003a 4d2b6eb6cc8cb43cc200000b 4d2b6ec2cc8cb43cc2000034 new_request true

View file

@ -380,7 +380,6 @@ describe DataConversion::ImportToMysql do
it "imports data into the notifications table" do it "imports data into the notifications table" do
Mongo::Notification.count.should == 2 Mongo::Notification.count.should == 2
Notification.count.should == 0 Notification.count.should == 0
debugger
@migrator.process_raw_notifications @migrator.process_raw_notifications
Notification.count.should == 2 Notification.count.should == 2
end end
@ -577,8 +576,11 @@ describe DataConversion::ImportToMysql do
notification = Mongo::Notification.first notification = Mongo::Notification.first
notification.mongo_id.should == "4d2b6eb8cc8cb43cc200001f" notification.mongo_id.should == "4d2b6eb8cc8cb43cc200001f"
notification.target_mongo_id.should == '4d2b6eb8cc8cb43cc200001e' notification.target_mongo_id.should == '4d2b6eb8cc8cb43cc200001e'
notification.target_type.should == "new_request" notification.recipient_mongo_id.should == "4d2b6eb7cc8cb43cc2000018"
notification.actor_mongo_id.should == "4d2b6eb7cc8cb43cc2000017"
notification.action.should == "new_request"
notification.unread.should be_true notification.unread.should be_true
notification.target_type.should == "Request"
end end
end end