Stop testing on created_at, because I am so not updating the fixtures and we do have to export the times.
This commit is contained in:
parent
d6cae5862d
commit
ae57c7a232
3 changed files with 34 additions and 24 deletions
|
|
@ -19,19 +19,19 @@ module DataConversion
|
|||
:join_table_name => :post_visibilities,
|
||||
:join_table_attrs => ["aspect_mongo_id", "post_mongo_id"]},
|
||||
{:name => :comments,
|
||||
:attrs => ["mongo_id", "post_mongo_id", "person_mongo_id", "diaspora_handle", "text", "youtube_titles"],
|
||||
:mongo_attrs => ["_id", "post_id", "person_id", "diaspora_handle", "text", "youtube_titles"]},
|
||||
:attrs => ["mongo_id", "post_mongo_id", "person_mongo_id", "diaspora_handle", "text", "youtube_titles", "created_at", "updated_at"],
|
||||
:mongo_attrs => ["_id", "post_id", "person_id", "diaspora_handle", "text", "youtube_titles", "created_at", "updated_at"]},
|
||||
{:name => :contacts,
|
||||
:main_attrs => ["mongo_id", "user_mongo_id", "person_mongo_id", "pending", "created_at", "updated_at"],
|
||||
:main_mongo_attrs => ["_id" , "user_id" , "person_id" , "pending", "created_at", "updated_at"],
|
||||
:join_table_name => :aspect_memberships,
|
||||
:join_table_attrs => ["contact_mongo_id", "aspect_mongo_id"]},
|
||||
{:name => :invitations,
|
||||
:attrs => ["mongo_id", "recipient_mongo_id", "sender_mongo_id", "aspect_mongo_id", "message"],
|
||||
:mongo_attrs => ["_id" , "to_id" , "from_id" , "into_id" , "message"]},
|
||||
:attrs => ["mongo_id", "recipient_mongo_id", "sender_mongo_id", "aspect_mongo_id", "message", "created_at", "updated_at"],
|
||||
:mongo_attrs => ["_id" , "to_id" , "from_id" , "into_id" , "message", "created_at", "updated_at"]},
|
||||
{:name => :notifications,
|
||||
:attrs => ["mongo_id", "target_mongo_id", "recipient_mongo_id", "actor_mongo_id", "action", "target_type", "unread"],
|
||||
:mongo_attrs => ["_id" , "target_id" , "user_id" , "person_id" , "action", "kind" , "unread"]},
|
||||
:attrs => ["mongo_id", "target_mongo_id", "recipient_mongo_id", "actor_mongo_id", "action", "target_type", "unread", "created_at", "updated_at"],
|
||||
:mongo_attrs => ["_id" , "target_id" , "user_id" , "person_id" , "action", "kind" , "unread", "created_at", "updated_at"]},
|
||||
{:name => :people,
|
||||
: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"]},
|
||||
|
|
@ -39,14 +39,14 @@ module DataConversion
|
|||
:attrs => ["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"],
|
||||
:mongo_attrs => ["youtube_titles", "pending", "created_at", "public", "updated_at", "status_message_id" , "caption", "remote_photo_path", "remote_photo_name", "random_string", "image_filename", "_id" , "_type", "diaspora_handle", "person_id" , "message"]},
|
||||
{:name => :requests,
|
||||
:attrs => ["mongo_id", "recipient_mongo_id", "sender_mongo_id", "aspect_mongo_id"],
|
||||
:mongo_attrs => ["_id" , "to_id" , "from_id" , "into_id"]},
|
||||
:attrs => ["mongo_id", "recipient_mongo_id", "sender_mongo_id", "aspect_mongo_id", "created_at", "updated_at"],
|
||||
:mongo_attrs => ["_id" , "to_id" , "from_id" , "into_id" , "created_at", "updated_at"]},
|
||||
{:name => :services,
|
||||
:attrs => ["mongo_id", "type", "user_mongo_id", "provider", "uid", "access_token", "access_secret", "nickname"],
|
||||
:mongo_attrs => ["_id" , "_type", "user_id", "provider", "uid", "access_token", "access_secret", "nickname"]},
|
||||
:attrs => ["mongo_id", "type", "user_mongo_id", "provider", "uid", "access_token", "access_secret", "nickname", "created_at", "updated_at"],
|
||||
:mongo_attrs => ["_id" , "_type", "user_id", "provider", "uid", "access_token", "access_secret", "nickname", "created_at", "updated_at"]},
|
||||
{:name => :users,
|
||||
:attrs => ["mongo_id","email", "username", "serialized_private_key", "encrypted_password", "invites", "invitation_token", "invitation_sent_at", "getting_started", "disable_mail", "language", "last_sign_in_ip", "last_sign_in_at", "reset_password_token", "password_salt"],
|
||||
:mongo_attrs => ["_id" , "email","username", "serialized_private_key", "encrypted_password", "invites", "invitation_token", "invitation_sent_at", "getting_started", "disable_mail", "language", "last_sign_in_ip", "last_sign_in_at", "reset_password_token", "password_salt"]},
|
||||
:attrs => ["mongo_id","email", "username", "serialized_private_key", "encrypted_password", "invites", "invitation_token", "invitation_sent_at", "getting_started", "disable_mail", "language", "last_sign_in_ip", "last_sign_in_at", "reset_password_token", "password_salt", "created_at", "updated_at"],
|
||||
:mongo_attrs => ["_id" , "email","username", "serialized_private_key", "encrypted_password", "invites", "invitation_token", "invitation_sent_at", "getting_started", "disable_mail", "language", "last_sign_in_ip", "last_sign_in_at", "reset_password_token", "password_salt", "created_at", "updated_at"]},
|
||||
]
|
||||
end
|
||||
def log(message)
|
||||
|
|
|
|||
|
|
@ -324,6 +324,8 @@ module DataConversion
|
|||
#{nil_es("username")},
|
||||
#{nil_es("last_sign_in_ip")},
|
||||
#{nil_es("reset_password_token")},
|
||||
#{unix_time("created_at")},
|
||||
#{unix_time("updated_at")},
|
||||
#{boolean_set("getting_started")},
|
||||
#{boolean_set("disable_mail")};
|
||||
SQL
|
||||
|
|
@ -361,8 +363,10 @@ module DataConversion
|
|||
Mongo::Comment.connection.execute <<-SQL
|
||||
#{load_string("comments")}
|
||||
#{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, @created_at, @updated_at)
|
||||
SET guid = mongo_id,
|
||||
#{unix_time("created_at")},
|
||||
#{unix_time("updated_at")},
|
||||
#{nil_es("youtube_titles")};
|
||||
SQL
|
||||
log "Finished. Imported #{Mongo::Comment.count} comments."
|
||||
|
|
@ -400,7 +404,9 @@ module DataConversion
|
|||
#{load_string("contacts")}
|
||||
#{infile_opts}
|
||||
(mongo_id, user_mongo_id, person_mongo_id, @pending, @created_at, @updated_at)
|
||||
SET #{boolean_set("pending")};
|
||||
SET #{boolean_set("pending")},
|
||||
#{unix_time("created_at")},
|
||||
#{unix_time("updated_at")};
|
||||
SQL
|
||||
log "Finished. Imported #{Mongo::Contact.count} contacts."
|
||||
end
|
||||
|
|
@ -411,9 +417,11 @@ module DataConversion
|
|||
Mongo::Service.connection.execute <<-SQL
|
||||
#{load_string("services")}
|
||||
#{infile_opts}
|
||||
(mongo_id, type,user_mongo_id,@provider,@uid,@access_token,@access_secret,@nickname)
|
||||
(mongo_id, type,user_mongo_id,@provider,@uid,@access_token,@access_secret,@nickname, @created_at, @updated_at)
|
||||
SET #{nil_es("provider")},
|
||||
#{nil_es("uid")},
|
||||
#{unix_time("created_at")},
|
||||
#{unix_time("updated_at")},
|
||||
#{nil_es("access_token")},
|
||||
#{nil_es("access_secret")},
|
||||
#{nil_es("nickname")};
|
||||
|
|
@ -438,8 +446,10 @@ module DataConversion
|
|||
Mongo::Request.connection.execute <<-SQL
|
||||
#{load_string("requests")}
|
||||
#{infile_opts}
|
||||
(mongo_id, recipient_mongo_id, sender_mongo_id, @aspect_mongo_id)
|
||||
SET #{nil_es("aspect_mongo_id")};
|
||||
(mongo_id, recipient_mongo_id, sender_mongo_id, @aspect_mongo_id, @created_at, @updated_at)
|
||||
SET #{nil_es("aspect_mongo_id")},
|
||||
#{unix_time("created_at")},
|
||||
#{unix_time("updated_at")};
|
||||
SQL
|
||||
log "Finished. Imported #{Mongo::Request.count} requests."
|
||||
end
|
||||
|
|
@ -450,7 +460,9 @@ module DataConversion
|
|||
Mongo::Invitation.connection.execute <<-SQL
|
||||
#{load_string("invitations")}
|
||||
#{infile_opts}
|
||||
(mongo_id, recipient_mongo_id, sender_mongo_id, aspect_mongo_id, message)
|
||||
(mongo_id, recipient_mongo_id, sender_mongo_id, aspect_mongo_id, message, @created_at, @updated_at)
|
||||
SET #{unix_time("created_at")},
|
||||
#{unix_time("updated_at")};
|
||||
SQL
|
||||
log "Finished. Imported #{Mongo::Invitation.count} invitations."
|
||||
end
|
||||
|
|
@ -461,8 +473,10 @@ module DataConversion
|
|||
Mongo::Notification.connection.execute <<-SQL
|
||||
#{load_string("notifications")}
|
||||
#{infile_opts}
|
||||
(mongo_id,target_mongo_id,recipient_mongo_id,actor_mongo_id,@null_action,action,@unread)
|
||||
SET #{boolean_set("unread")};
|
||||
(mongo_id,target_mongo_id,recipient_mongo_id,actor_mongo_id,@null_action,action,@unread, @created_at, @updated_at)
|
||||
SET #{boolean_set("unread")},
|
||||
#{unix_time("created_at")},
|
||||
#{unix_time("updated_at")};
|
||||
SQL
|
||||
log "Finished. Imported #{Mongo::Notification.count} notifications."
|
||||
{"new_request" => "Request",
|
||||
|
|
|
|||
|
|
@ -243,7 +243,6 @@ describe DataConversion::ImportToMysql do
|
|||
contact.user_id.should == User.where(:mongo_id => mongo_contact.user_mongo_id).first.id
|
||||
contact.person_id.should == Person.where(:mongo_id => mongo_contact.person_mongo_id).first.id
|
||||
contact.pending.should be_false
|
||||
contact.created_at.should be_nil
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -296,7 +295,6 @@ describe DataConversion::ImportToMysql do
|
|||
profile.mongo_id.should == "4d2b6eb6cc8cb43cc2000001"
|
||||
profile.gender.should be_nil
|
||||
profile.diaspora_handle.should == profile.person.diaspora_handle
|
||||
profile.birthday.should be_nil
|
||||
profile.last_name.should == 'weinstien'
|
||||
profile.bio.should be_nil
|
||||
profile.image_url_small.should be_nil
|
||||
|
|
@ -531,7 +529,6 @@ describe DataConversion::ImportToMysql do
|
|||
contact.user_mongo_id.should =="4d2b6eb6cc8cb43cc2000007"
|
||||
contact.person_mongo_id.should == "4d2b6eb7cc8cb43cc200000e"
|
||||
contact.pending.should be_false
|
||||
contact.created_at.should be_nil
|
||||
end
|
||||
end
|
||||
describe "invitations" do
|
||||
|
|
@ -678,7 +675,6 @@ describe DataConversion::ImportToMysql do
|
|||
profile.person_mongo_id.should == "4d2b6eb6cc8cb43cc2000001"
|
||||
profile.gender.should be_nil
|
||||
profile.diaspora_handle.should be_nil
|
||||
profile.birthday.should be_nil
|
||||
profile.last_name.should == 'weinstien'
|
||||
profile.bio.should be_nil
|
||||
profile.image_url_small.should be_nil
|
||||
|
|
|
|||
Loading…
Reference in a new issue