Problem with activeStorage Blob on upgrade from 6.0.3.4 to 6.1

in the ActiveStorage::Blob class on the initialization we have

after_initialize do
      self.service_name ||= self.class.service.name
end

but the self.service_name does not exist

my guess is that I have miss some migrations step on the upgrade ?

1 Like

Looks like Allow configure services for individual attachments by DmitryTsepelev · Pull Request #34935 · rails/rails · GitHub added a new column. You could use a migration like this rails/20190112182829_add_service_name_to_active_storage_blobs.rb at master · gmcgibbon/rails · GitHub

Hi @ghiculescu, thanks for the heads up

as stated on the PR the command to update is rails active_storage:update

will try this, hoping to not blow up my previous images :smiley:

You should be fine! It looks like the task just adds these migrations.

yup , it works , just wondering what will happen with the already uploaded files

I’ve created a PR for the documentation on release notes ActiveStorage upgrade command by michelson · Pull Request #40791 · rails/rails · GitHub

2 Likes

You should be fine. I just did this on one of my sites. The images were preserved. However, I belive the variants will need to be regenerated, because I think the stucture of the path have changed. On 6.1 the variant paths are similar to original image paths. They are now relatively short random strings.

1 Like