How can I migrate files from the old upload scheme (default/XXX) to the new one (default/original/{1,2}X)?

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.

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?

Back in July 2016, it looks like you could fix the problem by following these steps:

# 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, @tgxworld said that those instructions were “stale” and that this is the new procedure:

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

Now, just three days ago, @sam suggested the following:

./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?

5 Likes