class SetTerritoryAndTermForAcquiredMediaReleases < ActiveRecord::DataMigration
  def up
    say "Setting AcquiredMediaRelease#term and #territory.."
  
    AcquiredMediaRelease.find_each do |acquired_media_release|
      acquired_media_release.update(
        term: Term.find_by(label: acquired_media_release.term_old),
        territory: Territory.find_by(label: acquired_media_release.territory_old),
      )
    end

    say "Done."
  end

  def down
    say "Un-setting AcquiredMediaRelease#term and #territory.."

    AcquiredMediaRelease.update_all(term: nil, territory: nil)

    say "Done."
  end
end
