# S3 migrations from/to minio problems

**URL:** https://meta.discourse.org/t/s3-migrations-from-to-minio-problems/97333
**Category:** Bug
**Created:** [17.Сентябрь.2018 09:13:48 UTC](https://meta.discourse.org/t/s3-migrations-from-to-minio-problems/97333 "2018-09-17T09:13:48Z")
**Posts on this page:** 7
**Page:** 3

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [19.Март.2019 09:17:03 UTC](https://meta.discourse.org/t/s3-migrations-from-to-minio-problems/97333/44 "2019-03-19T09:17:03Z")

</div>

What does this return?

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

```

---

<div class="post-metadata">

### Author: ![hosna](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hosna/32/99969_2.png) [@hosna](https://meta.discourse.org/u/hosna)
#### Post date: [19.Март.2019 09:48:23 UTC](https://meta.discourse.org/t/s3-migrations-from-to-minio-problems/97333/45 "2019-03-19T09:48:23Z")

</div>

I got this:

```plaintext
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

```

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [19.Март.2019 10:11:52 UTC](https://meta.discourse.org/t/s3-migrations-from-to-minio-problems/97333/46 "2019-03-19T10:11:52Z")

</div>

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

---

<div class="post-metadata">

### Author: ![hosna](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hosna/32/99969_2.png) [@hosna](https://meta.discourse.org/u/hosna)
#### Post date: [19.Март.2019 10:15:24 UTC](https://meta.discourse.org/t/s3-migrations-from-to-minio-problems/97333/47 "2019-03-19T10:15:24Z")

</div>

you mean I should do this again?

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

```

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

---

<div class="post-metadata">

### Author: ![hosna](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hosna/32/99969_2.png) [@hosna](https://meta.discourse.org/u/hosna)
#### Post date: [19.Март.2019 10:20:59 UTC](https://meta.discourse.org/t/s3-migrations-from-to-minio-problems/97333/49 "2019-03-19T10:20:59Z")

</div>

> [@zogstrip](#):
>
> So you have 2 images that needs to be migrated.

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

```plaintext
[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

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

```

---

<div class="post-metadata">

### Author: ![hosna](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hosna/32/99969_2.png) [@hosna](https://meta.discourse.org/u/hosna)
#### Post date: [19.Март.2019 10:30:38 UTC](https://meta.discourse.org/t/s3-migrations-from-to-minio-problems/97333/50 "2019-03-19T10:30:38Z")

</div>

> [@tgxworld](#):
>
> What I meant is that the URL for your upload records are incorrect as
> 
> ```plaintext
> url: "/original/1X/dd758eae1e79c7a2b844d571da9c67ca1df02d39.mp3"
> 
> ```
> 
> should be
> 
> ```plaintext
> url: "/uploads/default/original/1X/dd758eae1e79c7a2b844d571da9c67ca1df02d39.mp3",
> 
> ```
> 
> My suggestion for now is to restore from a recent backup and try the migrate\_to\_s3 script again. If it doesn’t work, avoid running the `migrate_from_s3` script so that we can help you debug what is happening.

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

---

<div class="post-metadata">

### Author: ![rishabh](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rishabh/32/179446_2.png) [@rishabh](https://meta.discourse.org/u/rishabh)
#### Post date: [10.Январь.2020 05:11:22 UTC](https://meta.discourse.org/t/s3-migrations-from-to-minio-problems/97333/56 "2020-01-10T05:11:22Z")

</div>



[Предыдущая страница](https://meta.discourse.org/t/s3-migrations-from-to-minio-problems/97333.md?page=2)
