Migrate a phpBB3 forum to Discourse

In your second trial, Discourse is skipping the uploads because they already exist in the uploads table. Discourse avoids overwriting existing uploads unless explicitly instructed.

You can try adding the below code snippet in attachment_importer.rb (discourse/script/import_scripts/phpbb3/importers/attachment_importer.rb at main · discourse/discourse · GitHub) before calling @uploader.create_upload will ensure that any existing upload with the same filename is deleted first , forcing Discourse to re-upload it.

existing_upload = Upload.find_by(original_filename: filename)
if existing_upload
  existing_upload.destroy
  puts "Deleted existing upload: #{filename}"
end

upload = @uploader.create_upload(user_id, path, filename)
4 Likes