fix(storage): migrate all blob content types

Remove the image-only filter so storage migrations copy every Active Storage blob, including audio, documents, imports, exports, and enterprise attachments.
This commit is contained in:
Sony Mathew
2026-06-16 18:00:39 +05:30
parent 8558b6f4c0
commit 18b6681e9b
2 changed files with 2 additions and 4 deletions
-2
View File
@@ -35,8 +35,6 @@ class ActiveStorage::Migrator
def self.migrate_blobs(_from_service, to_service, to_service_name, update_service_name: true)
# Configure the blob service for the source service
ActiveStorage::Blob.find_each do |blob|
next unless blob.image?
Rails.logger.debug { '.' }
blob.open do |io|
+2 -2
View File
@@ -39,7 +39,7 @@ RSpec.describe ActiveStorage::Migrator do
describe '.migrate_blobs' do
let(:from_service_stub) { instance_double(ActiveStorage::Service) }
let(:to_service_stub) { instance_double(ActiveStorage::Service) }
let(:blob) { instance_double(ActiveStorage::Blob, image?: true, key: 'blob-key', checksum: 'checksum') }
let(:blob) { instance_double(ActiveStorage::Blob, key: 'blob-key', checksum: 'checksum') }
let(:io) { StringIO.new('blob-content') }
before do
@@ -47,7 +47,7 @@ RSpec.describe ActiveStorage::Migrator do
allow(blob).to receive(:open).and_yield(io)
end
it 'updates the blob service after uploading to the target service' do
it 'migrates blobs regardless of content type' do
expect(to_service_stub).to receive(:upload).with('blob-key', io, checksum: 'checksum').ordered
expect(blob).to receive(:update!).with(service_name: 'amazon').ordered