S3 migrations from/to minio problems

What does this return?

Upload.by_users.where("url NOT LIKE '//%' AND url NOT LIKE '/uploads/default/original/_X/%'").to_a

I got this:

rails c
Upload.by_users.where("url NOT LIKE '//%' AND url NOT LIKE '/uploads/default/original/_X/%'").to_a
[1] pry(main)> Upload.by_users.where("url NOT LIKE '//%' AND url NOT LIKE '/uploads/default/original/_X/%'").to_a
=> [#<Upload:0x0000562c3bbc4ce8
  id: 576,
  user_id: 250,
  original_filename: "IMG_۲۰۱۸۱۱۲۱_۱۸۱۶۱۴.jpg",
  filesize: 3928012,
  width: 4160,
  height: 2774,
  url: "/original/1X/1dd3317d1187a3876e566bfed3ab63f6cc7fa3e0.jpeg",
  created_at: Wed, 21 Nov 2018 14:51:05 UTC +00:00,
  updated_at: Wed, 21 Nov 2018 14:51:05 UTC +00:00,
  sha1: "1dd3317d1187a3876e566bfed3ab63f6cc7fa3e0",
  origin: nil,
  retain_hours: nil,
  extension: "jpeg",
  thumbnail_width: 690,
  thumbnail_height: 460,
  etag: nil>,
 #<Upload:0x0000562c3bbc4a18
  id: 541,
  user_id: 250,
  original_filename: "42830819_2684367061787501_565953382028611173_n.jpg",
  filesize: 51088,
  width: 640,
  height: 640,
  url: "/original/1X/5700585646fe5f67c06d9b1d31f66a934ef558e4.jpeg",
  created_at: Tue, 20 Nov 2018 16:01:15 UTC +00:00,
  updated_at: Tue, 20 Nov 2018 16:01:15 UTC +00:00,
  sha1: "5700585646fe5f67c06d9b1d31f66a934ef558e4",
  origin:
   "https://scontent-frt3-2.cdninstagram.com/vp/d666fc4425104d46b51e0f3a3e51042b/5BF6B743/t51.2885-15/e35/42830819_2684367061787501_565953382028611173_n.jpg",
  retain_hours: nil,
  extension: "jpeg",
  thumbnail_width: 500,
  thumbnail_height: 500,
  etag: nil>,
 #<Upload:0x0000562c3bbc4810

So you have 2 images that needs to be migrated. Are they still being used anywhere? If not, you can safely delete these records.

1 Like

you mean I should do this again?

SiteSetting.migrate_to_new_scheme = true
Jobs::MigrateUploadScheme.new.execute(nil)

and btw I should delete them manually? or there is an automatic way?

Sorry It seems Its more than that. I didn’t scroll down. They are too much

And this is what I get when I want to migrate uploads

[4] pry(main)> SiteSetting.migrate_to_new_scheme = true
=> true
[5] pry(main)> Jobs::MigrateUploadScheme.new.execute(nil)
=> []

and It seems there is no change in the result of

Upload.by_users.where("url NOT LIKE '//%' AND url NOT LIKE '/uploads/default/original/_X/%'").to_a

btw I think there is still something wrong with my urls as @tgxworld mentions here.

1 Like