skip individual checking

This commit is contained in:
Miha Mencin 2019-10-09 18:00:06 +02:00 committed by GitHub
parent 2ef095b003
commit e68b8f55c2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -30,10 +30,11 @@ class ConvertExperimentsToActiveStorage < ActiveRecord::Migration[5.2]
end.compact end.compact
next if attachments.blank? next if attachments.blank?
model.find_each.each do |instance| model.left_outer_joins(:workflowimg_attachment)
.where('active_storage_attachments.id IS NULL')
.find_each.each do |instance|
attachments.each do |attachment| attachments.each do |attachment|
next if instance.workflowimg.attached?
next if instance.__send__("#{attachment}_file_name").blank? next if instance.__send__("#{attachment}_file_name").blank?
res = ActiveRecord::Base.connection.raw_connection.exec_prepared( res = ActiveRecord::Base.connection.raw_connection.exec_prepared(