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 https://github.com/rails/rails/pull/34935 added a new column. You could use a migration like this https://github.com/gmcgibbon/rails/blob/master/activestorage/db/update_migrate/20190112182829_add_service_name_to_active_storage_blobs.rb

https://github.com/rails/rails/pull/34935#issuecomment-707141723

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 https://github.com/rails/rails/pull/40791

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