Only the time zone errors are left, and those could probably be ignored
This commit is contained in:
parent
079151eeea
commit
ee20b00f58
5 changed files with 12 additions and 15 deletions
|
|
@ -5,8 +5,6 @@
|
||||||
class ImageUploader < CarrierWave::Uploader::Base
|
class ImageUploader < CarrierWave::Uploader::Base
|
||||||
include CarrierWave::MiniMagick
|
include CarrierWave::MiniMagick
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def store_dir
|
def store_dir
|
||||||
"uploads/images"
|
"uploads/images"
|
||||||
end
|
end
|
||||||
|
|
@ -19,8 +17,6 @@ class ImageUploader < CarrierWave::Uploader::Base
|
||||||
model.random_string + model.id.to_s + File.extname(@filename) if @filename
|
model.random_string + model.id.to_s + File.extname(@filename) if @filename
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
version :thumb_small do
|
version :thumb_small do
|
||||||
process :resize_to_fill => [50,50]
|
process :resize_to_fill => [50,50]
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -36,8 +36,8 @@ module DataConversion
|
||||||
: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"]},
|
||||||
{:name => :posts,
|
{:name => :posts,
|
||||||
: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"],
|
: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", "_id" , "_type", "diaspora_handle", "person_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,
|
{:name => :requests,
|
||||||
:attrs => ["mongo_id", "recipient_mongo_id", "sender_mongo_id", "aspect_mongo_id"],
|
:attrs => ["mongo_id", "recipient_mongo_id", "sender_mongo_id", "aspect_mongo_id"],
|
||||||
:mongo_attrs => ["_id" , "to_id" , "from_id" , "into_id"]},
|
:mongo_attrs => ["_id" , "to_id" , "from_id" , "into_id"]},
|
||||||
|
|
|
||||||
|
|
@ -102,8 +102,9 @@ module DataConversion
|
||||||
|
|
||||||
log "Setting Photo -> StatusMessage relation column..."
|
log "Setting Photo -> StatusMessage relation column..."
|
||||||
Photo.connection.execute <<-SQL
|
Photo.connection.execute <<-SQL
|
||||||
SELECT * FROM posts
|
UPDATE posts AS photos, mongo_posts, posts AS statuses
|
||||||
WHERE posts.type = "Photo"
|
SET photos.status_message_id = statuses.id
|
||||||
|
WHERE photos.type = "Photo" AND mongo_posts.mongo_id = photos.mongo_id AND statuses.mongo_id = mongo_posts.status_message_mongo_id
|
||||||
SQL
|
SQL
|
||||||
log "Processed #{Photo.count} photos."
|
log "Processed #{Photo.count} photos."
|
||||||
end
|
end
|
||||||
|
|
|
||||||
4
spec/fixtures/data_conversion/posts.csv
vendored
4
spec/fixtures/data_conversion/posts.csv
vendored
|
|
@ -1,7 +1,7 @@
|
||||||
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
|
||||||
"",false,1294692030000,false,1294692030000,,,,,,,4d2b6ebecc8cb43cc2000027,StatusMessage,bob1d2f837@localhost,4d2b6eb6cc8cb43cc200000a,User2 can see this
|
"",false,1294692030000,false,1294692030000,,,,,,,4d2b6ebecc8cb43cc2000027,StatusMessage,bob1d2f837@localhost,4d2b6eb6cc8cb43cc200000a,User2 can see this
|
||||||
"",false,1294692030000,false,1294692030000,,,,,,,4d2b6ebecc8cb43cc2000029,StatusMessage,bob3c6c46f@localhost,4d2b6eb7cc8cb43cc2000017,User3 can see this
|
"",false,1294692030000,false,1294692030000,,,,,,,4d2b6ebecc8cb43cc2000029,StatusMessage,bob3c6c46f@localhost,4d2b6eb7cc8cb43cc2000017,User3 can see this
|
||||||
,false,1294692032000,false,1294692033000,4d2b6ebecc8cb43cc2000027,,,,mUKUIxkYlV,,4d2b6ebfcc8cb43cc200002d,Photo,bob2f66ee4@localhost,4d2b6eb7cc8cb43cc200000e,
|
,false,1294692030000,false,1294692030000,4d2b6ebecc8cb43cc2000027,,,,mUKUIxkYlV,mUKUIxkYlV4d2b6ebfcc8cb43cc200002d.png,4d2b6ebfcc8cb43cc200002d,Photo,bob2f66ee4@localhost,4d2b6eb7cc8cb43cc200000e,
|
||||||
,false,1294692034000,false,1294692034000,,,,,AtwSOhcrt0,,4d2b6ec1cc8cb43cc200002f,Photo,bob3c6c46f@localhost,4d2b6eb7cc8cb43cc2000017,
|
,false,1294692034000,false,1294692034000,,,,,AtwSOhcrt0,AtwSOhcrt04d2b6ec1cc8cb43cc200002f.png,4d2b6ec1cc8cb43cc200002f,Photo,bob3c6c46f@localhost,4d2b6eb7cc8cb43cc2000017,
|
||||||
,false,1294692036000,false,1294692036000,,,/uploads/images,3jcOyI5M444d2b6ec2cc8cb43cc2000036.png,,,4d2b6ec2cc8cb43cc2000036,Photo,bob5aa0fd5@localhost,4d2b6ec2cc8cb43cc2000034,
|
,false,1294692036000,false,1294692036000,,,/uploads/images,3jcOyI5M444d2b6ec2cc8cb43cc2000036.png,,,4d2b6ec2cc8cb43cc2000036,Photo,bob5aa0fd5@localhost,4d2b6ec2cc8cb43cc2000034,
|
||||||
"",false,1294692036000,false,1294692036000,,,,,,,4d2b6ec4cc8cb43cc2000037,StatusMessage,bob5aa0fd5@localhost,4d2b6ec2cc8cb43cc2000034,from another server!
|
"",false,1294692036000,false,1294692036000,,,,,,,4d2b6ec4cc8cb43cc2000037,StatusMessage,bob5aa0fd5@localhost,4d2b6ec2cc8cb43cc2000034,from another server!
|
||||||
|
|
|
||||||
|
|
|
@ -347,7 +347,7 @@ describe DataConversion::ImportToMysql do
|
||||||
|
|
||||||
it "imports the columns of a photo" do
|
it "imports the columns of a photo" do
|
||||||
@migrator.process_raw_posts
|
@migrator.process_raw_posts
|
||||||
post = Photo.first
|
post = Photo.where(:mongo_id => "4d2b6ebfcc8cb43cc200002d").first
|
||||||
mongo_post = Mongo::Post.where(:mongo_id => post.mongo_id).first
|
mongo_post = Mongo::Post.where(:mongo_id => post.mongo_id).first
|
||||||
post.youtube_titles.should be_nil
|
post.youtube_titles.should be_nil
|
||||||
post.pending.should == false
|
post.pending.should == false
|
||||||
|
|
@ -356,12 +356,12 @@ describe DataConversion::ImportToMysql do
|
||||||
post.caption.should be_nil
|
post.caption.should be_nil
|
||||||
post.remote_photo_path.should be_nil
|
post.remote_photo_path.should be_nil
|
||||||
post.remote_photo_name.should be_nil
|
post.remote_photo_name.should be_nil
|
||||||
post.random_string.should be_nil
|
post.random_string.should == "mUKUIxkYlV"
|
||||||
post.image.should be_nil
|
post.image.file.file.should =~ /mUKUIxkYlV4d2b6ebfcc8cb43cc200002d\.png/
|
||||||
post.mongo_id.should == "4d2b6ebfcc8cb43cc200002d"
|
post.mongo_id.should == "4d2b6ebfcc8cb43cc200002d"
|
||||||
post.guid.should == post.mongo_id
|
post.guid.should == post.mongo_id
|
||||||
post.person_id.should == Person.where(:mongo_id => mongo_post.person_mongo_id).first.id
|
post.person_id.should == Person.where(:mongo_id => mongo_post.person_mongo_id).first.id
|
||||||
post.diaspora_handle.should post.person.diaspora_handle
|
post.diaspora_handle.should == post.person.diaspora_handle
|
||||||
post.message.should be_nil
|
post.message.should be_nil
|
||||||
# puts post.created_at.utc? # == true
|
# puts post.created_at.utc? # == true
|
||||||
post.created_at.utc.to_i.should == 1294692032 # got 1294663230- minus 8 hours
|
post.created_at.utc.to_i.should == 1294692032 # got 1294663230- minus 8 hours
|
||||||
|
|
@ -556,12 +556,12 @@ describe DataConversion::ImportToMysql do
|
||||||
post.diaspora_handle.should == "bob1d2f837@localhost"
|
post.diaspora_handle.should == "bob1d2f837@localhost"
|
||||||
post.person_mongo_id.should == "4d2b6eb6cc8cb43cc200000a"
|
post.person_mongo_id.should == "4d2b6eb6cc8cb43cc200000a"
|
||||||
post.message.should == "User2 can see this"
|
post.message.should == "User2 can see this"
|
||||||
|
Mongo::Post.where(:mongo_id => "4d2b6ebfcc8cb43cc200002d").first.status_message_mongo_id.should == post.mongo_id
|
||||||
# puts post.created_at.utc? # == true
|
# puts post.created_at.utc? # == true
|
||||||
post.created_at.utc.to_i.should == 1294692030 # got 1294663230- minus 8 hours
|
post.created_at.utc.to_i.should == 1294692030 # got 1294663230- minus 8 hours
|
||||||
post.updated_at.to_i.should == 1294692030
|
post.updated_at.to_i.should == 1294692030
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
describe "notifications" do
|
describe "notifications" do
|
||||||
before do
|
before do
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue