another check to avoid unique index error in discourse_merger.rb
This commit is contained in:
parent
bd51cd52cd
commit
2786c79354
|
@ -546,6 +546,9 @@ class BulkImport::DiscourseMerger < BulkImport::Base
|
||||||
return nil if @imported_post_uploads[post_upload['post_id']] == post_upload['upload_id']
|
return nil if @imported_post_uploads[post_upload['post_id']] == post_upload['upload_id']
|
||||||
@imported_post_uploads[post_upload['post_id']] = post_upload['upload_id']
|
@imported_post_uploads[post_upload['post_id']] = post_upload['upload_id']
|
||||||
|
|
||||||
|
# ...and there are still duplicates. So try this:
|
||||||
|
return nil if PostUpload.where(post_id: post_upload['post_id'], upload_id: post_upload['upload_id']).exists?
|
||||||
|
|
||||||
post_upload
|
post_upload
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue