class MigratePersonNameFieldForAllReleases < ActiveRecord::DataMigration
  RELEASES = ["AcquiredMediaRelease", "AppearanceRelease", "LocationRelease", "MaterialRelease", "MusicRelease", "TalentRelease"]

  def up
    say 'Migrating person name ...'

    RELEASES.each do |release|
      release.constantize.find_each do |record|
        if record.person_name_old.present?
          record.update(person_name: record.person_name_old)
        end
      end
    end

    say 'Done'
  end
end