# 如何将文件从旧的上传方案（default/XXX）迁移到新的方案（default/original/{1,2}X）？

**URL:** <https://meta.discourse.org/t/how-can-i-migrate-files-from-the-old-upload-scheme-default-xxx-to-the-new-one-default-original-1-2-x/110813>\
**Category:** Support\
**Created:** [2019年三月6日 05:43 UTC](https://meta.discourse.org/t/how-can-i-migrate-files-from-the-old-upload-scheme-default-xxx-to-the-new-one-default-original-1-2-x/110813 "2019-03-06T05:43:02Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![kansaichris](https://avatars.discourse-cdn.com/v4/letter/k/ccd318/32.png) [@kansaichris](https://meta.discourse.org/u/kansaichris)\
**Post date:** [2019年三月7日 00:04 UTC](https://meta.discourse.org/t/how-can-i-migrate-files-from-the-old-upload-scheme-default-xxx-to-the-new-one-default-original-1-2-x/110813/5 "2019-03-07T00:04:27Z")

</div>

> [@zogstrip](#):
>
> Looks like you have images that were not migrated to the new scheme.  
> Have you disabled the `migrate to new scheme` site setting?

Interesting…I couldn’t find a “migrate to new scheme” site setting via the web interface; I assume you’re talking about a setting that can only be accessed from a Rails console within the Docker container? i.e.

```plaintext
cd /var/discourse/
sudo ./launcher enter app
rails c
> SiteSetting.migrate_to_new_scheme

```

In that case, you’re right: for some reason `SiteSetting.migrate_to_new_scheme` was `false`, but—having never heard of that setting before—I certainly never disabled it myself! Should it have automatically been changed to `true` at some point?

> [@zogstrip](#):
>
> If you want to restore images, it’s better to use the `uploads:recover_from_tombstone` rake task.

Back [in July 2016](https://meta.discourse.org/t/old-image-uploads-become-broken-images/47236), it looks like you could fix the problem by following these steps:

```plaintext
# copy the "deleted" images from their to-be-deleted staging area
cd /var/discourse
./launcher enter app
rake uploads:recover_from_tombstone

# rebake to see that it doesn't happen again
rake posts:rebake

```

Then, [in October 2018](https://meta.discourse.org/t/old-image-uploads-become-broken-images/47236/33), @tgxworld said that those instructions were “stale” and that this is the new procedure:

```plaintext
./launcher enter app
rails c
require_dependency "upload_recovery"
UploadRecovery.new.recover

```

Now, just [three days ago](https://meta.discourse.org/t/uploaded-files-mysteriously-going-missing/53361/14), @sam suggested the following:

```plaintext
./launcher enter app
rails c
> SiteSetting.migrate_to_new_scheme = true
.... wait a day
rake posts:rebake

```

Which of these three methods is considered best practice?

---

_[View the full topic](https://meta.discourse.org/t/how-can-i-migrate-files-from-the-old-upload-scheme-default-xxx-to-the-new-one-default-original-1-2-x/110813)._
